Don't forget the lvalue-to-rvalue conversion on the LHS of an -> when rebuilding

it during template instantiation, for a known RHS decl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142890 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Smith 2011-10-25 00:41:24 +00:00
Родитель f226ff9fe8
Коммит 97f9fe06e7
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -1485,6 +1485,11 @@ public:
ExprResult BaseResult = getSema().DefaultFunctionArrayConversion(Base);
if (BaseResult.isInvalid())
return ExprError();
if (isArrow) {
BaseResult = getSema().DefaultLvalueConversion(BaseResult.get());
if (BaseResult.isInvalid())
return ExprError();
}
Base = BaseResult.take();
QualType BaseType = Base->getType();

Просмотреть файл

@ -1509,4 +1509,25 @@ void foo() {
} // end namespace invalid_lock_expression_test
namespace template_member_test {
struct S { int n; };
struct T {
Mutex m;
S *s GUARDED_BY(this->m);
};
template<typename U>
struct IndirectLock {
int DoNaughtyThings(T *t) {
return t->s->n; // expected-warning {{reading variable 's' requires locking 'm'}}
}
};
struct MutexWrapper {
typedef Mutex Lock;
};
template struct IndirectLock<MutexWrapper>; // expected-note {{here}}
}