aboutsummaryrefslogtreecommitdiff
path: root/test/Parser
diff options
context:
space:
mode:
authorMichael Han <Michael.Han@autodesk.com>2012-11-06 19:34:54 +0000
committerMichael Han <Michael.Han@autodesk.com>2012-11-06 19:34:54 +0000
commitf64231e9f47234826fbcdc3b4fe0370ef6c9961d (patch)
tree5bf2e20734f073f7ee51d2c152d39c5a83abf442 /test/Parser
parentfd9d0e13a17b915fa6b35e3a3465513d67f1482d (diff)
Teach Clang parser to reject C++11 attributes that appertain to declaration specifiers.
We don't support any C++11 attributes that appertain to declaration specifiers so reject the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/cxx0x-attributes.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 5790e10044..58e42bffcf 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -223,3 +223,10 @@ namespace arguments {
void f(const char*, ...) [[gnu::format(printf, 1, 2)]]; // expected-warning {{unknown attribute 'format' ignored}}
void g() [[unknown::foo(currently arguments of attributes from unknown namespace other than 'gnu' namespace are ignored... blah...)]]; // expected-warning {{unknown attribute 'foo' ignored}}
}
+
+// forbid attributes on decl specifiers
+unsigned [[gnu::used]] static int [[gnu::unused]] v1; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
+ expected-error {{an attribute list cannot appear here}}
+typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
+ expected-error {{an attribute list cannot appear here}}
+int [[carries_dependency]] foo(int [[carries_dependency]] x); // expected-warning 2{{attribute 'carries_dependency' ignored, because it is not attached to a declaration}}