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

Nick Lewycky nlewycky at google.com
Thu Mar 15 20:55:50 PDT 2012


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!

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

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120315/ec3b6d27/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: friend-useless-lookup-1.patch
Type: application/octet-stream
Size: 875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120315/ec3b6d27/attachment.obj>


More information about the cfe-commits mailing list