diff options
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 8 | ||||
-rw-r--r-- | test/Sema/vla.c | 5 |
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}} +} |