parse.y (base_class.1): Produce a _TYPE not a _DECL.
cp: * parse.y (base_class.1): Produce a _TYPE not a _DECL. * semantics.c (finish_base_specifier): Accept a _TYPE not a _DECL. testsuite: * g++.old-deja/g++.other/base1.C: New test. From-SVN: r37817
This commit is contained in:
parent
2f3608c33e
commit
bb92901dc0
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
@ -2460,13 +2460,10 @@ base_class:
|
||||
|
||||
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:
|
||||
|
@ -2068,21 +2068,19 @@ finish_base_specifier (access_specifier, base_class)
|
||||
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;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
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.
|
||||
|
20
gcc/testsuite/g++.old-deja/g++.other/base1.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.other/base1.C
Normal file
@ -0,0 +1,20 @@
|
||||
// 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 {};
|
Loading…
Reference in New Issue
Block a user