* typeck.c (build_component_ref): Diagnose ref to nested type.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 10 Jun 1998 21:03:58 +0000 (21:03 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 10 Jun 1998 21:03:58 +0000 (17:03 -0400)
From-SVN: r20419

gcc/cp/ChangeLog
gcc/cp/typeck.c

index 6de230cc40e4d227a4e4b907ed8b214aac2917b1..5259df091ac58ea265616c7e24433f81cdb2b2ee 100644 (file)
@@ -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
index b3a40785969e871a9c5c93bd0f943022399f0aab..8c71a2442207e7fbb37028a51ef4ce5cc62ac0cb 100644 (file)
@@ -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