[PATCH] C++11: if decl-specifier has 'friend', do not allow access to 'this' pointer when parsing function declarator.
Ismail Pazarbasi
ismail.pazarbasi at gmail.com
Mon Mar 11 08:40:44 PDT 2013
================
Comment at: lib/Parse/ParseDecl.cpp:4819
@@ -4816,1 +4818,3 @@
+ (D.getDeclSpec().isFriendSpecified() ||
+ D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static));
Sema::CXXThisScopeRAII ThisScope(Actions,
----------------
Richard Smith wrote:
> This doesn't look right: you're checking for 'static' on member declarations within a class, but not checking for staticness of method definitions outside a class (and you're not applying the rule that 'operator new' and 'operator delete' are implicitly static).
>
> In short: you can't tell whether a method is static from here (because that requires name lookup).
Thank you for clarification.
I will drop the 'static' case for now and file a bug for future reference, but 'friend' case seems like fixed.
http://llvm-reviews.chandlerc.com/D468
More information about the cfe-commits
mailing list