[cfe-commits] r143016 - in /cfe/trunk: lib/Sema/TreeTransform.h test/SemaCXX/warn-thread-safety-analysis.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Tue Oct 25 23:15:36 PDT 2011
Author: rsmith
Date: Wed Oct 26 01:15:36 2011
New Revision: 143016
URL: http://llvm.org/viewvc/llvm-project?rev=143016&view=rev
Log:
UnresolvedMemberExprs need lvalue-to-rvalue conversions during template
instantiations too.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=143016&r1=143015&r2=143016&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Oct 26 01:15:36 2011
@@ -2145,6 +2145,13 @@
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,
Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=143016&r1=143015&r2=143016&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp Wed Oct 26 01:15:36 2011
@@ -1533,4 +1533,19 @@
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}}
+
}
More information about the cfe-commits
mailing list