Check for placeholders early on in
Sema::CreateUnaryExprOrTypeTraitExpr() rather than recursing in some cases. Fixes <rdar://problem/9659191>. llvm-svn: 133663
This commit is contained in:
parent
f942585dae
commit
835af98597
|
@ -3301,6 +3301,12 @@ Sema::CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo,
|
|||
ExprResult
|
||||
Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
|
||||
UnaryExprOrTypeTrait ExprKind) {
|
||||
ExprResult PE = CheckPlaceholderExpr(E);
|
||||
if (PE.isInvalid())
|
||||
return ExprError();
|
||||
|
||||
E = PE.get();
|
||||
|
||||
// Verify that the operand is valid.
|
||||
bool isInvalid = false;
|
||||
if (E->isTypeDependent()) {
|
||||
|
@ -3312,10 +3318,6 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
|
|||
} else if (E->getBitField()) { // C99 6.5.3.4p1.
|
||||
Diag(E->getExprLoc(), diag::err_sizeof_alignof_bitfield) << 0;
|
||||
isInvalid = true;
|
||||
} else if (E->getType()->isPlaceholderType()) {
|
||||
ExprResult PE = CheckPlaceholderExpr(E);
|
||||
if (PE.isInvalid()) return ExprError();
|
||||
return CreateUnaryExprOrTypeTraitExpr(PE.take(), OpLoc, ExprKind);
|
||||
} else {
|
||||
isInvalid = CheckUnaryExprOrTypeTraitOperand(E, UETT_SizeOf);
|
||||
}
|
||||
|
|
|
@ -13,3 +13,9 @@ void f(int); // expected-note{{candidate function}}
|
|||
void g() {
|
||||
sizeof(&f); // expected-error{{cannot resolve overloaded function 'f' from context}}
|
||||
}
|
||||
|
||||
template<typename T> void f_template(); // expected-note{{candidate function}}
|
||||
template<typename T> void f_template(T*); // expected-note{{candidate function}}
|
||||
void rdar9659191() {
|
||||
(void)alignof(f_template<int>); // expected-error{{cannot resolve overloaded function 'f_template' from context}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue