summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-06-13 03:23:42 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-06-13 03:23:42 +0000
commitd577fbbd1c9d6dab193d530fcd807efc3b3bc9ad (patch)
tree3afb98328f4fa456c083b11560db2c6a24b083f0 /clang/test
parent4055de40abf5536e4b88b399ca89274a1eec8869 (diff)
downloadbcm5719-llvm-d577fbbd1c9d6dab193d530fcd807efc3b3bc9ad.tar.gz
bcm5719-llvm-d577fbbd1c9d6dab193d530fcd807efc3b3bc9ad.zip
C++11: If a class has a user-declared copy operation or destructor, the
implicit definition of a copy operation is deprecated. Add a warning for this to -Wdeprecated. This warning is disabled by default for now, pending investigation into how common this situation is. llvm-svn: 183884
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/deprecated.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/deprecated.cpp b/clang/test/SemaCXX/deprecated.cpp
index 74dbf253564..b69dcb09dd2 100644
--- a/clang/test/SemaCXX/deprecated.cpp
+++ b/clang/test/SemaCXX/deprecated.cpp
@@ -33,3 +33,27 @@ struct T : private S {
// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
#endif
};
+
+#if __cplusplus >= 201103L
+namespace DeprecatedCopy {
+ struct Assign {
+ Assign &operator=(const Assign&); // expected-warning {{definition of implicit copy constructor for 'Assign' is deprecated because it has a user-declared copy assignment operator}}
+ };
+ Assign a1, a2(a1); // expected-note {{implicit default copy constructor for 'Assign' first required here}}
+
+ struct Ctor {
+ Ctor();
+ Ctor(const Ctor&); // expected-warning {{definition of implicit copy assignment operator for 'Ctor' is deprecated because it has a user-declared copy constructor}}
+ };
+ Ctor b1, b2;
+ void f() { b1 = b2; } // expected-note {{implicit default copy assignment operator for 'Ctor' first required here}}
+
+ struct Dtor {
+ ~Dtor();
+ // expected-warning@-1 {{definition of implicit copy constructor for 'Dtor' is deprecated because it has a user-declared destructor}}
+ // expected-warning@-2 {{definition of implicit copy assignment operator for 'Dtor' is deprecated because it has a user-declared destructor}}
+ };
+ Dtor c1, c2(c1); // expected-note {{implicit default copy constructor for 'Dtor' first required here}}
+ void g() { c1 = c2; } // expected-note {{implicit default copy assignment operator for 'Dtor' first required here}}
+}
+#endif
OpenPOWER on IntegriCloud