[cfe-commits] r152609 - in /cfe/trunk/lib: AST/DeclBase.cpp Sema/SemaLookup.cpp Serialization/ASTWriter.cpp

Chandler Carruth chandlerc at google.com
Thu Mar 15 21:20:15 PDT 2012


On Thu, Mar 15, 2012 at 8:55 PM, Nick Lewycky <nlewycky at google.com> wrote:

> On 15 March 2012 18:08, Eli Friedman <eli.friedman at gmail.com> wrote:
>
>> On Mon, Mar 12, 2012 at 9:12 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
>> > Author: nicholas
>> > Date: Mon Mar 12 23:12:34 2012
>> > New Revision: 152609
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=152609&view=rev
>> > Log:
>> > It never makes sense to do a lookup into a LinkageSpecDecl, so assert
>> that we
>> > don't, and clean up the places that do it.
>> >
>> > The change to ASTWriter is surprising, but the deleted code is a no-op
>> as of
>> > r152608.
>> >
>> > Modified:
>> >    cfe/trunk/lib/AST/DeclBase.cpp
>> >    cfe/trunk/lib/Sema/SemaLookup.cpp
>> >    cfe/trunk/lib/Serialization/ASTWriter.cpp
>> >
>> > Modified: cfe/trunk/lib/AST/DeclBase.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=152609&r1=152608&r2=152609&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/lib/AST/DeclBase.cpp (original)
>> > +++ cfe/trunk/lib/AST/DeclBase.cpp Mon Mar 12 23:12:34 2012
>> > @@ -1084,6 +1084,9 @@
>> >
>> >  DeclContext::lookup_result
>> >  DeclContext::lookup(DeclarationName Name) {
>> > +  assert(DeclKind != Decl::LinkageSpec &&
>> > +         "Should not perform lookups into linkage specs!");
>>
>> I'm seeing this assertion on g++.dg/parse/friend5.C from the gcc
>> testsuite:
>>
>> extern "C" struct A
>> {
>>  friend void foo(int) {} // { dg-error "declaration" }
>>  friend void foo() {} // { dg-error "foo" }
>> };
>>
>
> Thanks Eli! I've attached what I think is the right fix. Please review!
>

The patch to fix the crash is definitely fine. Please commit it.


> Also, this testcase was already broken in the sense that we accept invalid
> and weren't issuing an error on this construct.
>

Hmm. If it's easy to just reject this while we're here, we should.
Especially as that might obviate the need to halt lookup.

I'm fine with you committing the fix as-is to stop crashing, but please
leave FIXMEs in both the test and the code to clean this up and diagnose it
properly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120315/83984795/attachment.html>


More information about the cfe-commits mailing list