From 5159bbad8b2b3abbdda768eef64015bdd59293c6 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 5 Sep 2018 22:30:37 +0000 Subject: 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. llvm-svn: 341499 --- clang/test/SemaTemplate/instantiate-init.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/test/SemaTemplate/instantiate-init.cpp') diff --git a/clang/test/SemaTemplate/instantiate-init.cpp b/clang/test/SemaTemplate/instantiate-init.cpp index 51fa6955d0c..b58ad3a1576 100644 --- a/clang/test/SemaTemplate/instantiate-init.cpp +++ b/clang/test/SemaTemplate/instantiate-init.cpp @@ -115,8 +115,10 @@ namespace PR13064 { struct A { explicit A(int); }; // expected-note{{here}} template struct B { T a { 0 }; }; B b; - template struct C { T a = { 0 }; }; // expected-error{{explicit}} - C c; // expected-note {{in instantiation of default member initializer}} + template struct C { // expected-note {{in instantiation of default member initializer}} + T a = {0}; // expected-error{{explicit}} + }; + C c; // expected-note {{in evaluation of exception spec}} } namespace PR16903 { -- cgit v1.2.3