Commit d60ab851 by Jason Merrill Committed by Jason Merrill

* typeck.c (build_component_ref): Diagnose ref to nested type.

From-SVN: r20419
parent 3e2b9a3d
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> 1998-06-10 Brendan Kehoe <brendan@cygnus.com>
* decl.c (grokparms): Check that INIT isn't an error_mark_node * decl.c (grokparms): Check that INIT isn't an error_mark_node
......
...@@ -1959,10 +1959,12 @@ build_component_ref (datum, component, basetype_path, protect) ...@@ -1959,10 +1959,12 @@ build_component_ref (datum, component, basetype_path, protect)
hierarchy, the compiler will abort (because vptr lookups are hierarchy, the compiler will abort (because vptr lookups are
not supposed to be ambiguous. */ not supposed to be ambiguous. */
field = CLASSTYPE_VFIELD (basetype); field = CLASSTYPE_VFIELD (basetype);
else if (TREE_CODE (component) == FIELD_DECL else if (TREE_CODE (component) == FIELD_DECL)
|| TREE_CODE (component) == TYPE_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 else
{ {
...@@ -2049,10 +2051,7 @@ build_component_ref (datum, component, basetype_path, protect) ...@@ -2049,10 +2051,7 @@ build_component_ref (datum, component, basetype_path, protect)
if (TREE_CODE (field) != FIELD_DECL) if (TREE_CODE (field) != FIELD_DECL)
{ {
if (TREE_CODE (field) == TYPE_DECL) if (TREE_CODE (field) == TYPE_DECL)
{ cp_pedwarn ("invalid use of type decl `%#D' as expression", field);
cp_error ("invalid use of type decl `%#D' as expression", field);
return error_mark_node;
}
else if (DECL_RTL (field) != 0) else if (DECL_RTL (field) != 0)
mark_used (field); mark_used (field);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment