summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-11-08 15:33:35 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-11-08 15:33:35 +0000
commit730476b50ea63c79e590f91859097e16f88503a1 (patch)
tree9ef5033ebaba4ae9b953abd08c297d6ea7bd66fb /clang/test/Parser
parent423978923580a9c262f39a201ab4ee30b8a20a14 (diff)
downloadbcm5719-llvm-730476b50ea63c79e590f91859097e16f88503a1.tar.gz
bcm5719-llvm-730476b50ea63c79e590f91859097e16f88503a1.zip
[c++1z] Support for attributes on namespaces and enumerators.
llvm-svn: 221580
Diffstat (limited to 'clang/test/Parser')
-rw-r--r--clang/test/Parser/cxx0x-attributes.cpp5
-rw-r--r--clang/test/Parser/cxx1z-attributes.cpp12
2 files changed, 15 insertions, 2 deletions
diff --git a/clang/test/Parser/cxx0x-attributes.cpp b/clang/test/Parser/cxx0x-attributes.cpp
index f8abc76fb2f..3c36a6e1dc4 100644
--- a/clang/test/Parser/cxx0x-attributes.cpp
+++ b/clang/test/Parser/cxx0x-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat %s
// Need std::initializer_list
namespace std {
@@ -121,6 +121,7 @@ extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}}
[[]] using ns::i; // expected-error {{an attribute list cannot appear here}}
[[unknown]] using namespace ns; // expected-warning {{unknown attribute 'unknown' ignored}}
[[noreturn]] using namespace ns; // expected-error {{'noreturn' attribute only applies to functions}}
+namespace [[]] ns2 {} // expected-warning {{attribute on namespace declarations are incompatible with C++ standards before C++1z}}
using [[]] alignas(4) [[]] ns::i; // expected-error {{an attribute list cannot appear here}}
using [[]] alignas(4) [[]] foobar = int; // expected-error {{an attribute list cannot appear here}} expected-error {{'alignas' attribute only applies to}}
@@ -172,7 +173,7 @@ enum [[]] E2; // expected-error {{forbids forward references}}
enum [[]] E1;
enum [[]] E3 : int;
enum [[]] {
- k_123 [[]] = 123 // expected-error {{an attribute list cannot appear here}}
+ k_123 [[]] = 123 // expected-warning {{attribute on enumerator declarations are incompatible with C++ standards before C++1z}}
};
enum [[]] E1 e; // expected-error {{an attribute list cannot appear here}}
enum [[]] class E4 { }; // expected-error {{an attribute list cannot appear here}}
diff --git a/clang/test/Parser/cxx1z-attributes.cpp b/clang/test/Parser/cxx1z-attributes.cpp
new file mode 100644
index 00000000000..52b0a53ad8f
--- /dev/null
+++ b/clang/test/Parser/cxx1z-attributes.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s
+
+namespace [[]] foo {}
+namespace [[]] {}
+namespace [[]] bad = foo; // expected-error {{attributes cannot be specified on namespace alias}}
+
+enum test {
+ bing [[]],
+ bar [[]] = 1,
+ baz [[]][[]],
+ quux [[]][[]] = 4
+};
OpenPOWER on IntegriCloud