From d60ab851454d68a80339600fa6b333f43cc93e96 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 10 Jun 1998 21:03:58 +0000 Subject: * typeck.c (build_component_ref): Diagnose ref to nested type. From-SVN: r20419 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/typeck.c | 13 ++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6de230c..5259df0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +1998-06-10 Jason Merrill + + * typeck.c (build_component_ref): Diagnose ref to nested type. + 1998-06-10 Brendan Kehoe * decl.c (grokparms): Check that INIT isn't an error_mark_node diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b3a4078..8c71a24 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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 -- cgit v1.1