UnresolvedMemberExprs need lvalue-to-rvalue conversions during template

instantiations too.

llvm-svn: 143016
This commit is contained in:
Richard Smith 2011-10-26 06:15:36 +00:00
parent 82f4cf46aa
commit 3d5c1fa93f
2 changed files with 22 additions and 0 deletions

View File

@ -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,

View File

@ -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}}
}