summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/exception-spec.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-10-10 12:04:10 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-10-10 12:04:10 +0000
commit5d43164bc2e439c410f23ab460e73f3a53aba442 (patch)
treeca3f69f023ba1570a167586217a13449a0be0ce5 /clang/test/SemaCXX/exception-spec.cpp
parent65e69a77e1a5c0f06af62d988e652a7ef4161078 (diff)
downloadbcm5719-llvm-5d43164bc2e439c410f23ab460e73f3a53aba442.tar.gz
bcm5719-llvm-5d43164bc2e439c410f23ab460e73f3a53aba442.zip
Implement the core checking for compatible exception specifications in assignment and initialization.
The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet. This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment. llvm-svn: 83710
Diffstat (limited to 'clang/test/SemaCXX/exception-spec.cpp')
-rw-r--r--clang/test/SemaCXX/exception-spec.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/test/SemaCXX/exception-spec.cpp b/clang/test/SemaCXX/exception-spec.cpp
index 9d656ad2126..cb4cbf4a709 100644
--- a/clang/test/SemaCXX/exception-spec.cpp
+++ b/clang/test/SemaCXX/exception-spec.cpp
@@ -134,25 +134,25 @@ void fnptrs()
{
// Assignment and initialization of function pointers.
void (*t1)() throw() = &s1; // valid
- t1 = &s2; // invalid
- t1 = &s3; // invalid
- void (&t2)() throw() = s2; // invalid
+ t1 = &s2; // expected-error {{not superset}} expected-error {{incompatible type}}
+ t1 = &s3; // expected-error {{not superset}} expected-error {{incompatible type}}
+ void (&t2)() throw() = s2; // expected-error {{not superset}}
void (*t3)() throw(int) = &s2; // valid
void (*t4)() throw(A) = &s1; // valid
t4 = &s3; // valid
t4 = &s4; // valid
- t4 = &s5; // invalid
+ t4 = &s5; // expected-error {{not superset}} expected-error {{incompatible type}}
void (*t5)() = &s1; // valid
t5 = &s2; // valid
t5 = &s6; // valid
t5 = &s7; // valid
- t1 = t3; // invalid
+ t1 = t3; // expected-error {{not superset}} expected-error {{incompatible type}}
t3 = t1; // valid
void (*t6)() throw(B1);
- t6 = t4; // invalid
+ t6 = t4; // expected-error {{not superset}} expected-error {{incompatible type}}
t4 = t6; // valid
t5 = t1; // valid
- t1 = t5; // invalid
+ t1 = t5; // expected-error {{not superset}} expected-error {{incompatible type}}
// return types and arguments must match exactly, no inheritance allowed
void (*(*t7)())() throw(B1) = &s8; // valid
OpenPOWER on IntegriCloud