summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/exceptions.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-03-03 04:38:34 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-03-03 04:38:34 +0000
commitfba75df5993e38c5aa8a06247f08a1237c103ae7 (patch)
treeeb1a678d8e984b7774fd66d7e7fa00fa98202d74 /clang/test/SemaCXX/exceptions.cpp
parenta3ef8cad11cc11027e9194653280649a10671c38 (diff)
downloadbcm5719-llvm-fba75df5993e38c5aa8a06247f08a1237c103ae7.tar.gz
bcm5719-llvm-fba75df5993e38c5aa8a06247f08a1237c103ae7.zip
Sema: Caught exception objects should be unqualified
The exception object should be unqualified. Using a qualified exception object results in the wrong copy constructor getting called when the catch handler executes. llvm-svn: 231054
Diffstat (limited to 'clang/test/SemaCXX/exceptions.cpp')
-rw-r--r--clang/test/SemaCXX/exceptions.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/exceptions.cpp b/clang/test/SemaCXX/exceptions.cpp
index 5f4ff23eb77..6ac51b32e48 100644
--- a/clang/test/SemaCXX/exceptions.cpp
+++ b/clang/test/SemaCXX/exceptions.cpp
@@ -146,7 +146,7 @@ namespace Decay {
void rval_ref() throw (int &&); // expected-error {{rvalue reference type 'int &&' is not allowed in exception specification}} expected-warning {{C++11}}
-namespace ConstVolatile {
+namespace ConstVolatileThrow {
struct S {
S() {} // expected-note{{candidate constructor not viable}}
S(const S &s); // expected-note{{candidate constructor not viable}}
@@ -158,3 +158,22 @@ void f() {
throw CVS(); // expected-error{{no matching constructor for initialization}}
}
}
+
+namespace ConstVolatileCatch {
+struct S {
+ S() {}
+ S(const volatile S &s);
+
+private:
+ S(const S &s); // expected-note {{declared private here}}
+};
+
+void f();
+
+void g() {
+ try {
+ f();
+ } catch (volatile S s) { // expected-error {{calling a private constructor}}
+ }
+}
+}
OpenPOWER on IntegriCloud