diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-09-05 22:30:37 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-09-05 22:30:37 +0000 |
commit | 5786130f48520f80c14529cdbdf48968168b9a41 (patch) | |
tree | f8d0e94401536c0099d92491aa417828297c1913 /test/CXX | |
parent | b9640bc0c266e2c5d2ec36828dc1ac66ab903112 (diff) | |
download | clang-5786130f48520f80c14529cdbdf48968168b9a41.tar.gz |
PR38627: Fix handling of exception specification adjustment for
destructors.
We previously tried to patch up the exception specification after
completing the class, which went wrong when the exception specification
was needed within the class body (in particular, by a friend
redeclaration of the destructor in a nested class). We now mark the
destructor as having a not-yet-computed exception specification
immediately after creating it.
This requires delaying various checks against the exception
specification (where we'd previously have just got the wrong exception
specification, and now find we have an exception specification that we
can't compute yet) when those checks fire while the class is being
defined.
This also exposed an issue that we were missing a CodeSynthesisContext
for computation of exception specifications (otherwise we'd fail to make
the module containing the definition of the class visible when computing
its members' exception specs). Adding that incidentally also gives us a
diagnostic quality improvement.
This has also exposed an pre-existing problem: making the exception
specification evaluation context a non-SFINAE context (as it should be)
results in a bootstrap failure; PR38850 filed for this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/drs/dr13xx.cpp | 6 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp index f193c8e024..208ab8a03b 100644 --- a/test/CXX/drs/dr13xx.cpp +++ b/test/CXX/drs/dr13xx.cpp @@ -226,10 +226,10 @@ namespace dr1330 { // dr1330: 4 c++11 #endif void f(D &d) { d = d; } // ok - // FIXME: In C++11 onwards, we should also note the declaration of 'e' as the - // line that triggers the use of E::E()'s exception specification. struct E : C<int> {}; // expected-note {{in instantiation of}} - E e; +#if __cplusplus >= 201103L + E e; // expected-note {{needed here}} +#endif } namespace dr1346 { // dr1346: 3.5 diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp index 31213c9ebc..57e555e8d9 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp @@ -139,11 +139,11 @@ namespace NonLocalLambdaInstantation { } template<typename T> - struct X2 { + struct X2 { // expected-note{{in instantiation of default member initializer 'NonLocalLambdaInstantation::X2<int *>::x'}} int x = []{ return T(); }(); // expected-error{{cannot initialize a member subobject of type 'int' with an rvalue of type 'int *'}} }; X2<int> x2i; X2<float> x2f; - X2<int*> x2ip; // expected-note{{in instantiation of default member initializer 'NonLocalLambdaInstantation::X2<int *>::x'}} + X2<int*> x2ip; // expected-note {{in evaluation of exception spec}} } |