summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/namespaces.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-09 09:38:14 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-09 09:38:14 +0000
commit02e764487fa4a8e22e5ef3e8b2ab9c8361454b69 (patch)
treee961896f828f6cfea78b0ade6243711e188af44c /clang/test/Parser/namespaces.cpp
parented13fab4bc65ed8142070f9e8c9dc6e003287f87 (diff)
downloadbcm5719-llvm-02e764487fa4a8e22e5ef3e8b2ab9c8361454b69.tar.gz
bcm5719-llvm-02e764487fa4a8e22e5ef3e8b2ab9c8361454b69.zip
Parse: Don't crash when namespace is in GNU statement expr
Parser::ParseNamespace can get a little confused when it found itself inside a compound statement inside of a non-static data member initializer. Try to determine that the statement expression's scope makes sense before trying to parse it's contents. llvm-svn: 225514
Diffstat (limited to 'clang/test/Parser/namespaces.cpp')
-rw-r--r--clang/test/Parser/namespaces.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/test/Parser/namespaces.cpp b/clang/test/Parser/namespaces.cpp
index 6491cfd446b..25ff73b8ec0 100644
--- a/clang/test/Parser/namespaces.cpp
+++ b/clang/test/Parser/namespaces.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// PR6596
namespace g { enum { o = 0 }; }
@@ -10,3 +10,7 @@ void foo() {
// PR14085
namespace PR14085 {}
namespace = PR14085; // expected-error {{expected identifier}}
+
+struct namespace_nested_in_record {
+ int k = ({namespace {}}); // expected-error {{statement expression not allowed at file scope}}
+};
OpenPOWER on IntegriCloud