summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-06-13 02:02:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-06-13 02:02:51 +0000
commit8ca78a16f4a5bdc7e25b607d1063ce992ac51540 (patch)
tree920778dd4b850e614d683cfa119c4e267702f422 /clang/test/SemaCXX
parent2eabf78eb6affeece016b71a2df152c7aa38db4d (diff)
downloadbcm5719-llvm-8ca78a16f4a5bdc7e25b607d1063ce992ac51540.tar.gz
bcm5719-llvm-8ca78a16f4a5bdc7e25b607d1063ce992ac51540.zip
Add -Wdeprecated warnings and fixits for things deprecated in C++11:
- 'register' storage class - dynamic exception specifications Only the former check is enabled by default for now (the latter might be quite noisy). llvm-svn: 183881
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/attr-cxx0x.cpp2
-rw-r--r--clang/test/SemaCXX/deprecated.cpp31
2 files changed, 32 insertions, 1 deletions
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}}
+};
OpenPOWER on IntegriCloud