On 15 March 2012 18:08, Eli Friedman <[email protected]> wrote:

> On Mon, Mar 12, 2012 at 9:12 PM, Nick Lewycky <[email protected]> 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!

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

Nick

Attachment: friend-useless-lookup-1.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to