[cfe-commits] r81233 - in /cfe/trunk: include/clang/Parse/Action.h lib/Parse/ParseDeclCXX.cpp lib/Sema/Sema.h lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaTemplate.cpp test/CXX/temp/temp.decls/temp.friend/p1.cpp

John McCall rjmccall at apple.com
Wed Sep 9 00:00:51 PDT 2009


Douglas Gregor wrote:
>> +  // The parser doesn't quite handle
>> +  //   friend class A { ... }
>> +  // optimally, because it might have been the (valid) prefix of
>> +  //   friend class A { ... } foo();
>> +  // So in a very particular set of circumstances, we need to adjust
>> +  // IsDefinition.
>
> "friend class A { ... } foo();" is ill-formed, since types cannot be 
> defined in a return type (C++ [dcl.fct]p6).

Really?  Huh.  The more you know.  I'll change the comment.

Anyway, my problem is that the bit of parser 
(ParseCXXClassMemberDeclaration) that calls ActOnFriendDecl for 
standalone decl specs has already forgotten whether it saw a definition 
(which is known by ParseClassSpecifier but not propagated outward in a 
parser-sensible way), so it actually just lies to Sema and says it 
didn't.  This is how Sema recovers that information.  I can't really 
defend my design here;  it's an evolved hack, no question.  I'm 
balancing a couple of different ways to fix it.

John.



More information about the cfe-commits mailing list