aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-06 23:29:57 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-06 23:29:57 +0000
commit56ff283a1f8e4e898568426f56e67a096efd1f80 (patch)
tree3440cb2724001da3644104526b19eb41c68839e2
parent362ed2a95b70aaea4869bfa9ecaf581a6c180b40 (diff)
Fix a minor regression from my potentially-evaluated expression changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149930 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp8
-rw-r--r--test/Sema/vla.c5
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index a47421d801..8afe0c25b9 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9239,6 +9239,14 @@ namespace {
// Make sure we redo semantic analysis
bool AlwaysRebuild() { return true; }
+ // Make sure we handle LabelStmts correctly.
+ // FIXME: This does the right thing, but maybe we need a more general
+ // fix to TreeTransform?
+ StmtResult TransformLabelStmt(LabelStmt *S) {
+ S->getDecl()->setStmt(0);
+ return BaseTransform::TransformLabelStmt(S);
+ }
+
// We need to special-case DeclRefExprs referring to FieldDecls which
// are not part of a member pointer formation; normal TreeTransforming
// doesn't catch this case because of the way we represent them in the AST.
diff --git a/test/Sema/vla.c b/test/Sema/vla.c
index fd7a6bf3d7..4fd636122f 100644
--- a/test/Sema/vla.c
+++ b/test/Sema/vla.c
@@ -60,3 +60,8 @@ void pr5185(int a[*]);
void pr5185(int a[*]) // expected-error {{variable length array must be bound in function definition}}
{
}
+
+// Make sure this isn't treated as an error
+int TransformBug(int a) {
+ return sizeof(*(int(*)[({ goto v; v: a;})]) 0); // expected-warning {{use of GNU statement expression extension}}
+}