class.c (instantiate_type): Handle object-relative template-id.
[platform/upstream/gcc.git] / gcc / cp / parse.y
index 9a85922..ac053ab 100644 (file)
@@ -1,5 +1,6 @@
 /* YACC parser for C++ syntax.
-   Copyright (C) 1988, 89, 93-98, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000 Free Software Foundation, Inc.
    Hacked by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -440,9 +441,9 @@ program:
 extdefs:
                { $<ttype>$ = NULL_TREE; }
          lang_extdef
-               { $<ttype>$ = NULL_TREE; }
+               { $<ttype>$ = NULL_TREE; ggc_collect (); }
        | extdefs lang_extdef
-               { $<ttype>$ = NULL_TREE; }
+               { $<ttype>$ = NULL_TREE; ggc_collect (); }
        ;
 
 extdefs_opt:
@@ -775,7 +776,8 @@ constructor_declarator:
 
 fn.def1:
          typed_declspecs declarator
-               { if (!begin_function_definition ($1.t, $2))
+               { check_for_new_type ("return type", $1);
+                 if (!begin_function_definition ($1.t, $2))
                    YYERROR1; }
        | declmods notype_declarator
                { if (!begin_function_definition ($1.t, $2))
@@ -2205,7 +2207,7 @@ structsp:
                      /* struct B: public A; is not accepted by the standard grammar.  */
                      if (CLASS_TYPE_P ($$.t)
                          && TYPE_BINFO_BASETYPES ($$.t) 
-                         && !TYPE_SIZE ($$.t)
+                         && !COMPLETE_TYPE_P ($$.t)
                          && ! TYPE_BEING_DEFINED ($$.t))
                        cp_error ("base clause without member specification for `%#T'",
                                  $$.t);
@@ -2944,7 +2946,7 @@ typename_sub:
 typename_sub0:
          typename_sub1 identifier %prec EMPTY
                {
-                 if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
+                 if (TYPE_P ($1))
                    $$ = make_typename_type ($1, $2, /*complain=*/1);
                  else if (TREE_CODE ($2) == IDENTIFIER_NODE)
                    cp_error ("`%T' is not a class or namespace", $2);
@@ -2971,7 +2973,7 @@ typename_sub1:
                }
        | typename_sub1 typename_sub2
                {
-                 if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
+                 if (TYPE_P ($1))
                    $$ = make_typename_type ($1, $2, /*complain=*/1);
                  else if (TREE_CODE ($2) == IDENTIFIER_NODE)
                    cp_error ("`%T' is not a class or namespace", $2);