aboutsummaryrefslogtreecommitdiff
path: root/test/Parser
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-01-17 01:30:42 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-01-17 01:30:42 +0000
commitcd8ab51a44e80625d84126780b0d85a7732e25af (patch)
treeeb8a9f189b8553a98c361192ddb816b8f1703d5c /test/Parser
parent6c3af3d0e3e65bcbca57bfd458d684941f6d0531 (diff)
Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/cxx0x-attributes.cpp7
-rw-r--r--test/Parser/objcxx11-attributes.mm6
2 files changed, 8 insertions, 5 deletions
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index dac159a03f..ab6aa70c28 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -210,8 +210,11 @@ template<typename...Ts> void variadic() {
// Expression tests
void bar () {
- [] () [[noreturn]] { return; } (); // expected-error {{should not return}}
- [] () [[noreturn]] { throw; } ();
+ // FIXME: GCC accepts [[gnu::noreturn]] on a lambda, even though it appertains
+ // to the operator()'s type, and GCC does not otherwise accept attributes
+ // applied to types. Use that to test this.
+ [] () [[gnu::noreturn]] { return; } (); // expected-warning {{attribute 'noreturn' ignored}} FIXME-error {{should not return}}
+ [] () [[gnu::noreturn]] { throw; } (); // expected-warning {{attribute 'noreturn' ignored}}
new int[42][[]][5][[]]{};
}
diff --git a/test/Parser/objcxx11-attributes.mm b/test/Parser/objcxx11-attributes.mm
index 9ad85d310f..c72f26d101 100644
--- a/test/Parser/objcxx11-attributes.mm
+++ b/test/Parser/objcxx11-attributes.mm
@@ -13,12 +13,12 @@ void f(X *noreturn) {
int a[ [noreturn getSize] ];
// ... but is interpreted as an attribute where possible.
- int b[ [noreturn] ]; // expected-warning {{'noreturn' only applies to function types}}
+ int b[ [noreturn] ]; // expected-error {{'noreturn' attribute only applies to functions and methods}}
int c[ [noreturn getSize] + 1 ];
// An array size which is computed by a lambda is not OK.
- int d[ [noreturn] { return 3; } () ]; // expected-error {{expected ']'}} expected-warning {{'noreturn' only applies}}
+ int d[ [noreturn] { return 3; } () ]; // expected-error {{expected ']'}} expected-error {{'noreturn' attribute only applies}}
// A message send which contains a message send is OK.
[ [ X alloc ] init ];
@@ -40,7 +40,7 @@ void f(X *noreturn) {
expected-warning {{unknown attribute 'bitand' ignored}}
// FIXME: Suppress vexing parse warning
- [[noreturn]]int(e)(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
+ [[gnu::noreturn]]int(e)(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
int e2(); // expected-warning {{interpreted as a function declaration}} expected-note{{}}
// A function taking a noreturn function.