diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-06-10 21:03:58 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-06-10 17:03:58 -0400 |
commit | d60ab851454d68a80339600fa6b333f43cc93e96 (patch) | |
tree | 5521912cadd7aaa119372810f5cebe0318ab904e /gcc | |
parent | 3e2b9a3d254f1b324d572f00df30044e2e7066fe (diff) | |
download | gcc-d60ab851454d68a80339600fa6b333f43cc93e96.zip gcc-d60ab851454d68a80339600fa6b333f43cc93e96.tar.gz gcc-d60ab851454d68a80339600fa6b333f43cc93e96.tar.bz2 |
* typeck.c (build_component_ref): Diagnose ref to nested type.
From-SVN: r20419
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 13 |
2 files changed, 10 insertions, 7 deletions
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 <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 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 |