[cfe-commits] r140460 - in /cfe/trunk: include/clang/Parse/Parser.h include/clang/Sema/MultiInitializer.h include/clang/Sema/Sema.h lib/Parse/ParseCXXInlineMethods.cpp lib/Parse/ParseDeclCXX.cpp lib/Parse/ParseTemplate.cpp lib/Sema/MultiInitializ

Sebastian Redl sebastian.redl at getdesigned.at
Thu Sep 29 05:04:35 PDT 2011


On 28.09.2011 18:49, Benjamin Kramer wrote:
> On Mon, Sep 26, 2011 at 10:25, Jakob Stoklund Olesen<stoklund at 2pi.dk>  wrote:
>> Hi Sebastian,
>>
>> I think one of your commits in the range 140453-140466 broke the c++ part of the GCC test suite.
>>
>> g++.dg/parse/ctor3.C  (test for errors, line 7)
>> g++.dg/parse/ctor3.C (test for excess errors)
>>
>> Please check and fix.
> Still broken. Here's the difference in diagnostics before and after
> your commits:
>
> $ cat ctor3.C
> struct A {};
>
> struct B : A {
>    B() : A {} // { dg-error "expected" }
> };

This is supposed to test error recovery in an invalid constructor. In 
C++03, the next token after A has to be :: or (. The error is clearly 
that the initializer for A is missing the actual initializer arguments.
In C++11, however, {} is a valid initializer, so the problem is that the 
constructor body is missing.
I didn't want separate code paths for C++03 and C++11, so I just changed 
the parser to something that correctly parses both dialects. This means, 
though, that the parser still consumes the {} and only emits an error 
when it gets the the closing } of struct B. This shifts the error to the 
next line, which is why the test fails now.

So the fix is to move the dg-error directive one line down.

Sebastian




More information about the cfe-commits mailing list