* typeck.c (build_component_ref): Diagnose ref to nested type.
From-SVN: r20419
This commit is contained in:
parent
3e2b9a3d25
commit
d60ab85145
2 changed files with 10 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
|||
1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* typeck.c (build_component_ref): Diagnose ref to nested type.
|
||||
|
||||
1998-06-10 Brendan Kehoe <brendan@cygnus.com>
|
||||
|
||||
* decl.c (grokparms): Check that INIT isn't an error_mark_node
|
||||
|
|
|
@ -1959,10 +1959,12 @@ build_component_ref (datum, component, basetype_path, protect)
|
|||
hierarchy, the compiler will abort (because vptr lookups are
|
||||
not supposed to be ambiguous. */
|
||||
field = CLASSTYPE_VFIELD (basetype);
|
||||
else if (TREE_CODE (component) == FIELD_DECL
|
||||
|| TREE_CODE (component) == TYPE_DECL)
|
||||
else if (TREE_CODE (component) == FIELD_DECL)
|
||||
field = component;
|
||||
else if (TREE_CODE (component) == TYPE_DECL)
|
||||
{
|
||||
field = component;
|
||||
cp_pedwarn ("invalid use of type decl `%#D' as expression", component);
|
||||
return component;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2049,10 +2051,7 @@ build_component_ref (datum, component, basetype_path, protect)
|
|||
if (TREE_CODE (field) != FIELD_DECL)
|
||||
{
|
||||
if (TREE_CODE (field) == TYPE_DECL)
|
||||
{
|
||||
cp_error ("invalid use of type decl `%#D' as expression", field);
|
||||
return error_mark_node;
|
||||
}
|
||||
cp_pedwarn ("invalid use of type decl `%#D' as expression", field);
|
||||
else if (DECL_RTL (field) != 0)
|
||||
mark_used (field);
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue