+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (base_class.1): Produce a _TYPE not a _DECL.
+ * semantics.c (finish_base_specifier): Accept a _TYPE not a
+ _DECL.
+
2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
* spew.c (yyerror): Cope if yylval.ttype is NULL.
base_class.1:
typename_sub
- { if ($$ == error_mark_node)
- ;
- else if (!TYPE_P ($$))
- $$ = error_mark_node;
- else
- $$ = TYPE_MAIN_DECL ($1); }
+ { if (!TYPE_P ($$))
+ $$ = error_mark_node; }
| nonnested_type
+ { $$ = TREE_TYPE ($$); }
;
base_class_access_list:
tree access_specifier;
tree base_class;
{
- tree type;
tree result;
- if (base_class == NULL_TREE)
- {
- error ("invalid base class");
- type = error_mark_node;
- }
- else
- type = TREE_TYPE (base_class);
-
- if (! is_aggr_type (type, 1))
+ if (! is_aggr_type (base_class, 1))
result = NULL_TREE;
else
- result = build_tree_list (access_specifier, type);
+ {
+ if (CP_TYPE_QUALS (base_class) != 0)
+ {
+ cp_error ("base class `%T' has cv qualifiers", base_class);
+ base_class = TYPE_MAIN_VARIANT (base_class);
+ }
+ result = build_tree_list (access_specifier, base_class);
+ }
return result;
}
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.other/base1.C: New test.
+
2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.other/parse2.C: New test.
--- /dev/null
+// Build don't link:
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 25 Nov 2000 <nathan@codesourcery.com>
+
+// We lost information about which base wasn't an aggregate type, plus we
+// allowed cv qualifed bases via typedefs.
+
+typedef int I;
+typedef int cI;
+
+struct A {};
+
+typedef const A cA;
+typedef A pA;
+
+struct B : I {}; // ERROR - not an aggregate
+struct C : cI {}; // ERROR - not an aggregate
+struct D : cA {}; // ERROR - cv qualified
+struct E : pA {};