summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-10-20 21:04:13 +0000
committerReid Kleckner <rnk@google.com>2015-10-20 21:04:13 +0000
commit744e3e7fc7e108ae2958c0a04813b3fb8ae62fa1 (patch)
tree878f53f899fa2ccf72268e71f939c02059edf2e7 /clang/lib/Sema/TreeTransform.h
parent853b88d7ff26f02750786c6c10e53494900bc185 (diff)
downloadbcm5719-llvm-744e3e7fc7e108ae2958c0a04813b3fb8ae62fa1.tar.gz
bcm5719-llvm-744e3e7fc7e108ae2958c0a04813b3fb8ae62fa1.zip
Re-land r250592 without rejecting field refs in unevaluated contexts
This time, I went with the first approach from http://reviews.llvm.org/D6700, where clang actually attempts to form an implicit member reference from an UnresolvedLookupExpr. We know that there are only two possible outcomes at this point, a DeclRefExpr of the FieldDecl or an error, but its safer to reuse the existing machinery for this. llvm-svn: 250856
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 31d69cbac35..513c6285e96 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -9127,9 +9127,20 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(
SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
// If we have neither explicit template arguments, nor the template keyword,
- // it's a normal declaration name.
- if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid())
+ // it's a normal declaration name or member reference.
+ if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid()) {
+ NamedDecl *D = R.getAsSingle<NamedDecl>();
+ // In a C++11 unevaluated context, an UnresolvedLookupExpr might refer to an
+ // instance member. In other contexts, BuildPossibleImplicitMemberExpr will
+ // give a good diagnostic.
+ if (D && D->isCXXInstanceMember()) {
+ return SemaRef.BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc, R,
+ /*TemplateArgs=*/nullptr,
+ /*Scope=*/nullptr);
+ }
+
return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
+ }
// If we have template arguments, rebuild them, then rebuild the
// templateid expression.
OpenPOWER on IntegriCloud