зеркало из https://github.com/microsoft/clang-1.git
Fix crash-on-invalid: only use TransformAddressOfOperand when transforming the
operand of a unary address-of expression, not for *all* expressions! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182436 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
bdaeaed3e3
Коммит
82b0001f79
|
@ -6320,7 +6320,11 @@ TreeTransform<Derived>::TransformAddressOfOperand(Expr *E) {
|
|||
template<typename Derived>
|
||||
ExprResult
|
||||
TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) {
|
||||
ExprResult SubExpr = TransformAddressOfOperand(E->getSubExpr());
|
||||
ExprResult SubExpr;
|
||||
if (E->getOpcode() == UO_AddrOf)
|
||||
SubExpr = TransformAddressOfOperand(E->getSubExpr());
|
||||
else
|
||||
SubExpr = TransformExpr(E->getSubExpr());
|
||||
if (SubExpr.isInvalid())
|
||||
return ExprError();
|
||||
|
||||
|
|
|
@ -36,3 +36,13 @@ namespace PR5880 {
|
|||
|
||||
template void test_anon_union<int>();
|
||||
}
|
||||
|
||||
namespace AddrOfClassMember {
|
||||
template <typename T> struct S {
|
||||
int n;
|
||||
static void f() {
|
||||
+T::n; // expected-error {{invalid use of member}}
|
||||
}
|
||||
};
|
||||
void g() { S<S<int> >::f(); } // expected-note {{in instantiation of}}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче