diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CXX/class/class.friend/p6.cpp | 4 | ||||
| -rw-r--r-- | clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp | 2 | ||||
| -rw-r--r-- | clang/test/FixIt/fixit-cxx0x.cpp | 5 | ||||
| -rw-r--r-- | clang/test/Sema/thread-specifier.c | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/attr-cxx0x.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/deprecated.cpp | 31 |
6 files changed, 44 insertions, 4 deletions
diff --git a/clang/test/CXX/class/class.friend/p6.cpp b/clang/test/CXX/class/class.friend/p6.cpp index 82ca50e485d..ae327391a9a 100644 --- a/clang/test/CXX/class/class.friend/p6.cpp +++ b/clang/test/CXX/class/class.friend/p6.cpp @@ -4,7 +4,11 @@ class A { friend static class B; // expected-error {{'static' is invalid in friend declarations}} friend extern class C; // expected-error {{'extern' is invalid in friend declarations}} +#if __cplusplus < 201103L friend register class E; // expected-error {{'register' is invalid in friend declarations}} +#else + friend register class E; // expected-error {{'register' is invalid in friend declarations}} expected-warning {{deprecated}} +#endif friend mutable class F; // expected-error {{'mutable' is invalid in friend declarations}} friend typedef class G; // expected-error {{'typedef' is invalid in friend declarations}} friend __thread class G; // expected-error {{'__thread' is invalid in friend declarations}} diff --git a/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp index b159a15b8d4..c23cd28f313 100644 --- a/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp +++ b/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp @@ -117,7 +117,7 @@ void g() { for (extern int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'extern'}} for (static int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'static'}} - for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}} + for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}} expected-warning {{deprecated}} for (constexpr int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'constexpr'}} for (auto u : X::NoBeginADL()) { // expected-error {{invalid range expression of type 'X::NoBeginADL'; no viable 'begin' function available}} diff --git a/clang/test/FixIt/fixit-cxx0x.cpp b/clang/test/FixIt/fixit-cxx0x.cpp index 1f6275f933b..bfd8c3dcfea 100644 --- a/clang/test/FixIt/fixit-cxx0x.cpp +++ b/clang/test/FixIt/fixit-cxx0x.cpp @@ -132,3 +132,8 @@ namespace NonStaticConstexpr { } }; } + +int RegisterVariable() { + register int n; // expected-warning {{'register' storage class specifier is deprecated}} + return n; +} diff --git a/clang/test/Sema/thread-specifier.c b/clang/test/Sema/thread-specifier.c index 9d516e8f141..bf1ce9e26e4 100644 --- a/clang/test/Sema/thread-specifier.c +++ b/clang/test/Sema/thread-specifier.c @@ -2,8 +2,8 @@ // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DGNU // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic %s -DC11 -D__thread=_Thread_local // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DCXX11 -D__thread=thread_local -std=c++11 -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11 +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DCXX11 -D__thread=thread_local -std=c++11 -Wno-deprecated +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11 -Wno-deprecated #ifdef __cplusplus // In C++, we define __private_extern__ to extern. diff --git a/clang/test/SemaCXX/attr-cxx0x.cpp b/clang/test/SemaCXX/attr-cxx0x.cpp index e9276cd2d9e..fb46af40359 100644 --- a/clang/test/SemaCXX/attr-cxx0x.cpp +++ b/clang/test/SemaCXX/attr-cxx0x.cpp @@ -12,7 +12,7 @@ struct align_member { }; void f(alignas(1) char c) { // expected-error {{'alignas' attribute cannot be applied to a function parameter}} - alignas(1) register char k; // expected-error {{'alignas' attribute cannot be applied to a variable with 'register' storage class}} + alignas(1) register char k; // expected-error {{'alignas' attribute cannot be applied to a variable with 'register' storage class}} expected-warning {{deprecated}} try { } catch (alignas(4) int n) { // expected-error {{'alignas' attribute cannot be applied to a 'catch' variable}} } diff --git a/clang/test/SemaCXX/deprecated.cpp b/clang/test/SemaCXX/deprecated.cpp new file mode 100644 index 00000000000..fde2c3754c6 --- /dev/null +++ b/clang/test/SemaCXX/deprecated.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify +// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify +// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify + +void f() throw(); +void g() throw(int); +void h() throw(...); +#if __cplusplus >= 201103L +// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}} +// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}} +#endif + +void stuff() { + register int n; +#if __cplusplus >= 201103L + // expected-warning@-2 {{'register' storage class specifier is deprecated}} +#endif + + bool b; + ++b; // expected-warning {{incrementing expression of type bool is deprecated}} + + // FIXME: This is ill-formed in C++11. + char *p = "foo"; // expected-warning {{conversion from string literal to 'char *' is deprecated}} +} + +struct S { int n; }; +struct T : private S { + // FIXME: This is ill-formed in C++11. + S::n; // expected-warning {{access declarations are deprecated; use using declarations instead}} +}; |

