summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-25 10:04:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-25 10:04:07 +0000
commiteae99680e30ba57b9e3793a159549c9b9429d773 (patch)
tree9d83bb2808d19ae7939234ccf42c8b54e74599e9 /clang/lib/Sema
parent978cc7306cb665226e94e583f36049971b2fe26f (diff)
downloadbcm5719-llvm-eae99680e30ba57b9e3793a159549c9b9429d773.tar.gz
bcm5719-llvm-eae99680e30ba57b9e3793a159549c9b9429d773.zip
PR11956: C++11's special exception for accessing non-static data members from
unevaluated operands applies within member functions, too. llvm-svn: 151443
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExprMember.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp
index 54296942d0d..e90d6e1bc98 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -138,25 +138,25 @@ static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef,
if (Classes.empty())
return IMA_Static;
+ if (SemaRef.getLangOptions().CPlusPlus0x && isField) {
+ // C++11 [expr.prim.general]p12:
+ // An id-expression that denotes a non-static data member or non-static
+ // member function of a class can only be used:
+ // (...)
+ // - if that id-expression denotes a non-static data member and it
+ // appears in an unevaluated operand.
+ const Sema::ExpressionEvaluationContextRecord& record
+ = SemaRef.ExprEvalContexts.back();
+ if (record.Context == Sema::Unevaluated)
+ return IMA_Field_Uneval_Context;
+ }
+
// If the current context is not an instance method, it can't be
// an implicit member reference.
if (isStaticContext) {
if (hasNonInstance)
- return IMA_Mixed_StaticContext;
-
- if (SemaRef.getLangOptions().CPlusPlus0x && isField) {
- // C++11 [expr.prim.general]p12:
- // An id-expression that denotes a non-static data member or non-static
- // member function of a class can only be used:
- // (...)
- // - if that id-expression denotes a non-static data member and it
- // appears in an unevaluated operand.
- const Sema::ExpressionEvaluationContextRecord& record
- = SemaRef.ExprEvalContexts.back();
- if (record.Context == Sema::Unevaluated)
- return IMA_Field_Uneval_Context;
- }
-
+ return IMA_Mixed_StaticContext;
+
return IMA_Error_StaticContext;
}
OpenPOWER on IntegriCloud