forked from OSchip/llvm-project
Fixed isConstantInitializer for __builtin_choose_expr.
llvm-svn: 114820
This commit is contained in:
parent
972c60d821
commit
b59a5b6784
|
@ -1764,6 +1764,9 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef) const {
|
|||
case ParenExprClass:
|
||||
return cast<ParenExpr>(this)->getSubExpr()
|
||||
->isConstantInitializer(Ctx, IsForRef);
|
||||
case ChooseExprClass:
|
||||
return cast<ChooseExpr>(this)->getChosenSubExpr(Ctx)
|
||||
->isConstantInitializer(Ctx, IsForRef);
|
||||
case UnaryOperatorClass: {
|
||||
const UnaryOperator* Exp = cast<UnaryOperator>(this);
|
||||
if (Exp->getOpcode() == UO_Extension)
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
struct foo { int a, b; };
|
||||
|
||||
static struct foo t = (struct foo){0,0};
|
||||
static struct foo t2 = {0,0};
|
||||
static struct foo t1 = __builtin_choose_expr(0, (struct foo){0,0}, (struct foo){0,0});
|
||||
static struct foo t2 = {0,0};
|
||||
static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
|
||||
static int *p = (int []){2,4};
|
||||
static int *p = (int []){2,4};
|
||||
static int x = (int){1};
|
||||
|
||||
static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
|
||||
|
|
Loading…
Reference in New Issue