re PR c++/13651 (double error message when using incomplete types in a struct)
authorMark Mitchell <mark@codesourcery.com>
Mon, 19 Jan 2004 22:10:31 +0000 (22:10 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 19 Jan 2004 22:10:31 +0000 (22:10 +0000)
PR c++/13651
* parser.c (cp_parser_postfix_expression): When encountering
incomplete type on left-hand side of "->" or ".", treat the entire
expression as erroneous.

From-SVN: r76180

gcc/cp/ChangeLog
gcc/cp/parser.c

index 976b0752fd638bbe61284dafb586e90ef2cad63e..c6a5f943d4c4a1cf104e91a5f21e86a434e779f8 100644 (file)
@@ -1,5 +1,10 @@
 2004-01-19  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/13651
+       * parser.c (cp_parser_postfix_expression): When encountering
+       incomplete type on left-hand side of "->" or ".", treat the entire
+       expression as erroneous.
+
        PR c++/13592
        * call.c (build_field_call): Remove.
        (n_build_method_call): Likewise.
index a9b62d068b1ca91129211fc5266a94ab7cd1d1a7..284afc68c7da41c916a216b6c97281c9a3843075 100644 (file)
@@ -3849,6 +3849,11 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p)
                   being dependent.  */
                if (!scope)
                  scope = error_mark_node;
+               /* If the SCOPE was erroneous, make the various
+                  semantic analysis functions exit quickly -- and
+                  without issuing additional error messages.  */
+               if (scope == error_mark_node)
+                 postfix_expression = error_mark_node;
              }
 
            /* Consume the `.' or `->' operator.  */