diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-03 21:38:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-03 21:38:09 +0000 |
commit | 2b6ca46c6b66096bc5dfc6f82c46cfb1761f4f53 (patch) | |
tree | 7881f432fe5f94b677450a7615703ef1e31e3782 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | 59a1cd4a063a65983551a73dd858116fe2a01bbc (diff) | |
download | bcm5719-llvm-2b6ca46c6b66096bc5dfc6f82c46cfb1761f4f53.tar.gz bcm5719-llvm-2b6ca46c6b66096bc5dfc6f82c46cfb1761f4f53.zip |
Improve template instantiation for member access expressions that
involve qualified names, e.g., x->Base::f. We now maintain enough
information in the AST to compare the results of the name lookup of
"Base" in the scope of the postfix-expression (determined at template
definition time) and in the type of the object expression.
llvm-svn: 80953
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 87330ab0b63..b88ee897523 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1789,9 +1789,20 @@ Sema::ActOnStartCXXMemberReference(Scope *S, ExprArg Base, SourceLocation OpLoc, // We could end up with various non-record types here, such as extended // vector types or Objective-C interfaces. Just return early and let // ActOnMemberReferenceExpr do the work. - if (!BaseType->isRecordType()) + if (!BaseType->isRecordType()) { + // C++ [basic.lookup.classref]p2: + // [...] If the type of the object expression is of pointer to scalar + // type, the unqualified-id is looked up in the context of the complete + // postfix-expression. + ObjectType = 0; return move(Base); + } + // C++ [basic.lookup.classref]p2: + // If the id-expression in a class member access (5.2.5) is an + // unqualified-id, and the type of the object expres- sion is of a class + // type C (or of pointer to a class type C), the unqualified-id is looked + // up in the scope of class C. [...] ObjectType = BaseType.getAsOpaquePtr(); return move(Base); } |