Commit b0e0b31f by Mark Mitchell Committed by Mark Mitchell

cp-tree.h: Revert previous change.

	* cp-tree.h: Revert previous change.
	(finish_struct_methods): Remove declaration.
	* class.c: Revert previous change.
	(maybe_warn_about_overly_private_class): New function.
	(finish_struct_methods): Declare here, and make static.  Remove
	unnecessary parameters.  Tidy slightly.  Use
	maybe_warn_about_overly_private_class.
	(finish_struct_1): Adjust.  Remove check for private constructors,
	now done elsewhere.
	(finish_struct): Adjust.

From-SVN: r22426
parent bf71cd2e
1998-09-15 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h: Revert previous change.
(finish_struct_methods): Remove declaration.
* class.c: Revert previous change.
(maybe_warn_about_overly_private_class): New function.
(finish_struct_methods): Declare here, and make static. Remove
unnecessary parameters. Tidy slightly. Use
maybe_warn_about_overly_private_class.
(finish_struct_1): Adjust. Remove check for private constructors,
now done elsewhere.
(finish_struct): Adjust.
1998-09-15 Andrew MacLeod <amacleod@cygnus.com> 1998-09-15 Andrew MacLeod <amacleod@cygnus.com>
* except.c (expand_start_catch_block): No need to check for new * except.c (expand_start_catch_block): No need to check for new
...@@ -15,6 +28,14 @@ ...@@ -15,6 +28,14 @@
1998-09-14 Mark Mitchell <mark@markmitchell.com> 1998-09-14 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (lang_type): Add has_non_private_static_mem_fn.
(CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN): New macro, to access it.
* class.c (maybe_class_too_private_p): New function.
(finish_struct_methods): Use it.
(finish_struct_1): Likewise.
(finish_struct): Set CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN if
appropriate.
* pt.c (check_specialization_scope): Fix spelling error. * pt.c (check_specialization_scope): Fix spelling error.
(check_explicit_specialization): Remove code to handle explicit (check_explicit_specialization): Remove code to handle explicit
specializations in class scope; they are now correctly diagnosed specializations in class scope; they are now correctly diagnosed
......
...@@ -621,12 +621,11 @@ struct lang_type ...@@ -621,12 +621,11 @@ struct lang_type
unsigned has_complex_assign_ref : 1; unsigned has_complex_assign_ref : 1;
unsigned has_abstract_assign_ref : 1; unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1; unsigned non_aggregate : 1;
unsigned has_non_private_static_mem_fn : 1;
/* The MIPS compiler gets it wrong if this struct also /* The MIPS compiler gets it wrong if this struct also
does not fill out to a multiple of 4 bytes. Add a does not fill out to a multiple of 4 bytes. Add a
member `dummy' with new bits if you go over the edge. */ member `dummy' with new bits if you go over the edge. */
unsigned dummy : 10; unsigned dummy : 11;
} type_flags; } type_flags;
int n_ancestors; int n_ancestors;
...@@ -1452,10 +1451,6 @@ extern int flag_new_for_scope; ...@@ -1452,10 +1451,6 @@ extern int flag_new_for_scope;
#define TYPE_NON_AGGREGATE_CLASS(NODE) \ #define TYPE_NON_AGGREGATE_CLASS(NODE) \
(IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
/* Nonzero if NODE has a non-private static member function. */
#define CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN(NODE) \
(TYPE_LANG_SPECIFIC (NODE)->type_flags.has_non_private_static_mem_fn)
/* Nonzero if there is a user-defined X::op=(x&) for this class. */ /* Nonzero if there is a user-defined X::op=(x&) for this class. */
#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref) #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref) #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
...@@ -2414,7 +2409,6 @@ extern tree get_vfield_offset PROTO((tree)); ...@@ -2414,7 +2409,6 @@ extern tree get_vfield_offset PROTO((tree));
extern void duplicate_tag_error PROTO((tree)); extern void duplicate_tag_error PROTO((tree));
extern tree finish_struct PROTO((tree, tree, tree, int)); extern tree finish_struct PROTO((tree, tree, tree, int));
extern tree finish_struct_1 PROTO((tree, int)); extern tree finish_struct_1 PROTO((tree, int));
extern tree finish_struct_methods PROTO((tree, tree, int));
extern int resolves_to_fixed_type_p PROTO((tree, int *)); extern int resolves_to_fixed_type_p PROTO((tree, int *));
extern void init_class_processing PROTO((void)); extern void init_class_processing PROTO((void));
extern int is_empty_class PROTO((tree)); extern int is_empty_class PROTO((tree));
......
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
// 04 // 04
// local names (14.6.1 p 4) // local names (14.6.1 p 4)
template <class T10, int i> class Xfour {// ERROR - .* template <class T10, int i> struct Xfour {// ERROR - .*
int T10; // ERROR - .* int T10; // ERROR - .*
void f(){ void f(){
char T10; // ERROR - .* char T10; // ERROR - .*
...@@ -90,7 +90,7 @@ template <class T10, int i> class Xfour {// ERROR - .* ...@@ -90,7 +90,7 @@ template <class T10, int i> class Xfour {// ERROR - .*
// 05 // 05
// using different tempate-parms for out-of-line defs // using different tempate-parms for out-of-line defs
template <class T12, int i> class Xfive { template <class T12, int i> struct Xfive {
void f(); void f();
}; };
...@@ -189,7 +189,7 @@ public: ...@@ -189,7 +189,7 @@ public:
// 13 // 13
// member templates, non-type parameters // member templates, non-type parameters
template <long l>// ERROR - .* template <long l>// ERROR - .*
class Xthirteen { struct Xthirteen {
template <long l> long comp_ge(long test) {// ERROR - . template <long l> long comp_ge(long test) {// ERROR - .
long local_value; long local_value;
if (local_value > value) if (local_value > value)
......
...@@ -112,7 +112,7 @@ protected: ...@@ -112,7 +112,7 @@ protected:
// 20 // 20
// local names (14.6.1 p 4) part two, variable names as template param // local names (14.6.1 p 4) part two, variable names as template param
template <class T17, int i> class Xtwenty { template <class T17, int i> struct Xtwenty {
void f(){ void f(){
T17 my_type; //ok T17 my_type; //ok
for (int j = 0; j < 5; ++l) for (int j = 0; j < 5; ++l)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Build don't link: // Build don't link:
template <class T> template <class T>
class A { struct A {
int i; int i;
Blarg () : i(0) { } // ERROR - Blarg () : i(0) { } // ERROR -
}; };
// Build don't link:
class A {
};
class B {
public:
void f();
private:
B ();
B (const B&);
}; // WARNING - only private constructors
class C {
public:
void f();
private:
~C ();
}; // WARNING - only private destructors
class D {
private:
void f();
}; // WARNING - all member functions are private
template <class T>
class X {
private:
~X ();
}; // WARNING - only private destructors
template class X<int>;
template class X<double>;
template <class T>
class Y {
private:
Y ();
Y (const Y&);
}; // WARNING - only private constructors
template <class T>
class Z {
private:
void f();
}; // WARNING - all member functions are private
...@@ -4,7 +4,7 @@ template <class T> ...@@ -4,7 +4,7 @@ template <class T>
class S class S
{ {
template <class U> template <class U>
class S2 { struct S2 {
S2(const S2<U>& s2u) {} S2(const S2<U>& s2u) {}
}; };
}; };
......
// Build don't link: // Build don't link:
// GROUPS passed membertemplates // GROUPS passed membertemplates
template <class T> template <class T>
class S struct S
{ {
S(const S<T>& x) {} S(const S<T>& x) {}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Build don't link: // Build don't link:
template <class T> template <class T>
class A struct A
{ {
typedef enum typedef enum
{ {
......
...@@ -6,7 +6,7 @@ class a ...@@ -6,7 +6,7 @@ class a
vector<s> vs; vector<s> vs;
friend class b; friend class b;
}; };
class b struct b
{ {
vector<a> va; vector<a> va;
operator vector< vector<s> >() operator vector< vector<s> >()
......
...@@ -6,7 +6,7 @@ class a ...@@ -6,7 +6,7 @@ class a
vector<s> vs; vector<s> vs;
friend class b; friend class b;
}; };
class b struct b
{ {
vector<a> va; vector<a> va;
operator vector< vector<s> >() operator vector< vector<s> >()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment