summaryrefslogtreecommitdiffstats
path: root/test/Parser/cxx0x-attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser/cxx0x-attributes.cpp')
-rw-r--r--test/Parser/cxx0x-attributes.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 5e4e388..b02add9 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -122,6 +122,24 @@ extern "C++" [[]] { } // 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 and methods}}
+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}}
+
+void bad_attributes_in_do_while() {
+ do {} while (
+ [[ns::i); // expected-error {{expected ']'}} \
+ // expected-note {{to match this '['}} \
+ // expected-error {{expected expression}}
+ do {} while (
+ [[a]b ns::i); // expected-error {{expected ']'}} \
+ // expected-note {{to match this '['}} \
+ // expected-error {{expected expression}}
+ do {} while (
+ [[ab]ab] ns::i); // expected-error {{an attribute list cannot appear here}}
+ do {} while ( // expected-note {{to match this '('}}
+ alignas(4 ns::i; // expected-note {{to match this '('}}
+} // expected-error 2{{expected ')'}} expected-error {{expected expression}}
+
[[]] using T = int; // expected-error {{an attribute list cannot appear here}}
using T [[]] = int; // ok
template<typename T> using U [[]] = T;
@@ -281,3 +299,23 @@ int v5()[[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}}
[[attribute_declaration]]; // expected-warning {{unknown attribute 'attribute_declaration' ignored}}
[[noreturn]]; // expected-error {{'noreturn' attribute only applies to functions and methods}}
[[carries_dependency]]; // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
+
+class A {
+ A([[gnu::unused]] int a);
+};
+A::A([[gnu::unused]] int a) {}
+
+namespace GccConst {
+ // GCC's tokenizer treats const and __const as the same token.
+ [[gnu::const]] int *f1();
+ [[gnu::__const]] int *f2();
+ void f(const int *);
+ void g() { f(f1()); f(f2()); }
+}
+
+namespace GccASan {
+ __attribute__((no_address_safety_analysis)) void f1();
+ __attribute__((no_sanitize_address)) void f2();
+ [[gnu::no_address_safety_analysis]] void f3();
+ [[gnu::no_sanitize_address]] void f4();
+}
OpenPOWER on IntegriCloud