summaryrefslogtreecommitdiffstats
path: root/test/Parser/cxx0x-attributes.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerdim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commit952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /test/Parser/cxx0x-attributes.cpp
parentea266cad53e3d49771fa38103913d3ec7a166694 (diff)
downloadFreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip
FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
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