aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/ExprConstant.cpp4
-rw-r--r--test/Sema/const-eval.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index e5bff359f8..f33827ff7c 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -1436,6 +1436,10 @@ public:
}
bool Success(const CCValue &V, const Expr *E) {
+ if (V.isLValue()) {
+ Result = V;
+ return true;
+ }
return Success(V.getInt(), E);
}
bool Error(const Expr *E) {
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index 6dcc6db765..ee55ca871f 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -88,3 +88,6 @@ void rdar8875946() {
}
double d = (d = 0.0); // expected-error {{not a compile-time constant}}
+
+int n = 2;
+int intLvalue[*(int*)((long)&n ?: 1)] = { 1, 2 }; // expected-error {{variable length array}}