This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

typedef and current_class_type


The attached program gives

b.ii:8: warning: ANSI C++ does not permit `S::i' to be defined as `T::i'
b.ii:9: warning: ANSI C++ does not permit `S::j' to be defined as `T::j'
b.ii:9: Internal compiler error.
b.ii:9: Please submit a full bug report to `egcs-bugs@cygnus.com'.

with the current egcs. The main reason is that current_class_type is
set to the typedef, so various tests for equality fail.

Martin

1998-05-22  Martin von Loewis  <loewis@informatik.hu-berlin.de>

	* parse.y (complex_direct_notype_declarator): Use $1 to access
	scope of notype_qualified_id

	* class.c (pushclass): Always store TYPE_MAIN_VARIANT in
	current_class_type	

Index: class.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/class.c,v
retrieving revision 1.54
diff -c -p -r1.54 class.c
*** class.c	1998/05/20 23:28:07	1.54
--- class.c	1998/05/22 00:03:23
*************** pushclass (type, modify)
*** 4671,4676 ****
--- 4671,4677 ----
       tree type;
       int modify;
  {
+   type = TYPE_MAIN_VARIANT (type);
    push_memoized_context (type, modify);
  
    current_class_depth++;
Index: parse.y
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/parse.y,v
retrieving revision 1.57
diff -c -p -r1.57 parse.y
*** parse.y	1998/05/20 23:28:11	1.57
--- parse.y	1998/05/22 00:04:03
*************** complex_direct_notype_declarator:
*** 2741,2750 ****
  	| direct_notype_declarator '[' ']'
  		{ $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
  	| notype_qualified_id
! 		{ if (OP0 ($$) != current_class_type)
  		    {
! 		      push_nested_class (OP0 ($$), 3);
! 		      TREE_COMPLEXITY ($$) = current_class_depth;
  		    }
  		}
          | nested_name_specifier notype_template_declarator
--- 2770,2779 ----
  	| direct_notype_declarator '[' ']'
  		{ $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
  	| notype_qualified_id
! 		{ if (OP0 ($1) != current_class_type)
  		    {
! 		      push_nested_class (OP0 ($1), 3);
! 		      TREE_COMPLEXITY ($1) = current_class_depth;
  		    }
  		}
          | nested_name_specifier notype_template_declarator

//Build don't link:
struct S{

  static const int i;
  static const int j;
};

typedef S T;
const int T::i = 4;
const int T::j = 4;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]