summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-10-26 06:15:36 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-10-26 06:15:36 +0000
commit3d5c1fa93facbd101c7571036c7efc3a6d5e409b (patch)
treec72e14844c55f8e69f8e94c557e40ebf4ffab0ae
parent82f4cf46aa52e927e734f05d46b3c4696dca9b47 (diff)
downloadbcm5719-llvm-3d5c1fa93facbd101c7571036c7efc3a6d5e409b.tar.gz
bcm5719-llvm-3d5c1fa93facbd101c7571036c7efc3a6d5e409b.zip
UnresolvedMemberExprs need lvalue-to-rvalue conversions during template
instantiations too. llvm-svn: 143016
-rw-r--r--clang/lib/Sema/TreeTransform.h7
-rw-r--r--clang/test/SemaCXX/warn-thread-safety-analysis.cpp15
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 59c132caccd..7fb2d35c706 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -2145,6 +2145,13 @@ public:
CXXScopeSpec SS;
SS.Adopt(QualifierLoc);
+ if (BaseE && IsArrow) {
+ ExprResult BaseResult = getSema().DefaultLvalueConversion(BaseE);
+ if (BaseResult.isInvalid())
+ return ExprError();
+ BaseE = BaseResult.take();
+ }
+
return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
OperatorLoc, IsArrow,
SS, FirstQualifierInScope,
diff --git a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
index b4d44170fec..ff290198c01 100644
--- a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
+++ b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -1533,4 +1533,19 @@ namespace template_member_test {
template struct IndirectLock<int>; // expected-note {{here}}
+ struct V {
+ void f(int);
+ void f(double);
+
+ Mutex m;
+ V *p GUARDED_BY(this->m);
+ };
+ template<typename U> struct W {
+ V v;
+ void f(U u) {
+ v.p->f(u); // expected-warning {{reading variable 'p' requires locking 'm'}}
+ }
+ };
+ template struct W<int>; // expected-note {{here}}
+
}
OpenPOWER on IntegriCloud