diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-08 00:44:49 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-08 00:44:49 +0000 |
| commit | e513cd25bdb51aee94bd1848baf6c4689315a347 (patch) | |
| tree | 4c6142762424920c38d9b4f135a32da7305e415e /clang | |
| parent | d5d796ecdee7e8b80d1f912f03b80ba70db61011 (diff) | |
| download | bcm5719-llvm-e513cd25bdb51aee94bd1848baf6c4689315a347.tar.gz bcm5719-llvm-e513cd25bdb51aee94bd1848baf6c4689315a347.zip | |
Move [[nodiscard]] tests into test/CXX tree.
llvm-svn: 262888
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp (renamed from clang/test/SemaCXX/nodiscard.cpp) | 5 | ||||
| -rw-r--r-- | clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p3.cpp | 17 |
2 files changed, 17 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/nodiscard.cpp b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp index 4eb004c67df..3d4b9251881 100644 --- a/clang/test/SemaCXX/nodiscard.cpp +++ b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp @@ -22,13 +22,8 @@ void f() { (void)get_e(); } -[[nodiscard nodiscard]] int wrong1(); // expected-error {{attribute 'nodiscard' cannot appear multiple times in an attribute specifier}} - -namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to functions, methods, enums, and classes}} - #ifdef EXT // expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}} // expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}} // expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@25 2{{use of the 'nodiscard' attribute is a C++1z extension}} #endif diff --git a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p3.cpp b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p3.cpp new file mode 100644 index 00000000000..a3543cff7d2 --- /dev/null +++ b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p3.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++1z -verify %s + +namespace std_example { + struct [[nodiscard]] error_info{ + // ... + }; + + error_info enable_missile_safety_mode(); + void launch_missiles(); + void test_missiles() { + enable_missile_safety_mode(); // expected-warning {{ignoring return value of function declared with 'nodiscard'}} + launch_missiles(); + } + + error_info &foo(); + void f() { foo(); } // no warning +} |

