hokein updated this revision to Diff 257302.
hokein added a comment.

fix the broken tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78100/new/

https://reviews.llvm.org/D78100

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/class.access/p4.cpp
  clang/test/CXX/special/class.ctor/p5-0x.cpp
  clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
  clang/test/SemaCXX/virtual-base-used.cpp
  clang/test/SemaObjCXX/arc-0x.mm

Index: clang/test/SemaObjCXX/arc-0x.mm
===================================================================
--- clang/test/SemaObjCXX/arc-0x.mm
+++ clang/test/SemaObjCXX/arc-0x.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -fobjc-weak -verify -fblocks -fobjc-exceptions %s
+// RUN: %clang_cc1 -frecovery-ast -std=c++11 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -fobjc-weak -verify -fblocks -fobjc-exceptions %s
 
 // "Move" semantics, trivial version.
 void move_it(__strong id &&from) {
@@ -116,13 +116,13 @@
   // Implicitly-declared special functions of a union are deleted by default if
   // ARC is enabled and the union has an ObjC pointer field.
   union U0 {
-    id f0; // expected-note 7 {{'U0' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
+    id f0; // expected-note 6 {{'U0' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
   };
 
   union U1 {
-    __weak id f0; // expected-note 13 {{'U1' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
+    __weak id f0; // expected-note 12 {{'U1' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
     U1() = default; // expected-warning {{explicitly defaulted default constructor is implicitly deleted}} expected-note {{explicitly defaulted function was implicitly deleted here}}
-    ~U1() = default; // expected-warning {{explicitly defaulted destructor is implicitly deleted}} expected-note 2{{explicitly defaulted function was implicitly deleted here}}
+    ~U1() = default; // expected-warning {{explicitly defaulted destructor is implicitly deleted}} expected-note {{explicitly defaulted function was implicitly deleted here}}
     U1(const U1 &) = default; // expected-warning {{explicitly defaulted copy constructor is implicitly deleted}} expected-note 2 {{explicitly defaulted function was implicitly deleted here}}
     U1(U1 &&) = default; // expected-warning {{explicitly defaulted move constructor is implicitly deleted}}
     U1 & operator=(const U1 &) = default; // expected-warning {{explicitly defaulted copy assignment operator is implicitly deleted}} expected-note 2 {{explicitly defaulted function was implicitly deleted here}}
@@ -154,15 +154,15 @@
   // functions of the containing class.
   struct S0 {
     union {
-      id f0; // expected-note 7 {{'' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
+      id f0; // expected-note 6 {{'' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
       char f1;
     };
   };
 
   struct S1 {
     union {
-      union { // expected-note 2 {{'S1' is implicitly deleted because variant field '' has a non-trivial}} expected-note 5 {{'S1' is implicitly deleted because field '' has a deleted}}
-        id f0; // expected-note 3 {{'' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
+      union { // expected-note 2 {{'S1' is implicitly deleted because variant field '' has a non-trivial}} expected-note 4 {{'S1' is implicitly deleted because field '' has a deleted}}
+        id f0; // expected-note 2 {{'' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
         char f1;
       };
       int f2;
@@ -172,7 +172,7 @@
   struct S2 {
     union {
       // FIXME: the note should say 'f0' is causing the special functions to be deleted.
-      struct { // expected-note 7 {{'S2' is implicitly deleted because variant field '' has a non-trivial}}
+      struct { // expected-note 6 {{'S2' is implicitly deleted because variant field '' has a non-trivial}}
         id f0;
         int f1;
       };
@@ -189,18 +189,14 @@
   S1 *x5;
   S2 *x6;
 
-  static union { // expected-error {{call to implicitly-deleted default constructor of}} expected-error {{attempt to use a deleted function}}
-    id g0; // expected-note {{default constructor of '' is implicitly deleted because variant field 'g0' is an ObjC pointer}} \
-           // expected-note {{destructor of '' is implicitly deleted because}}
+  static union { // expected-error {{call to implicitly-deleted default constructor of}}
+    id g0; // expected-note {{default constructor of '' is implicitly deleted because variant field 'g0' is an ObjC pointer}}
   };
 
-  static union { // expected-error {{call to implicitly-deleted default constructor of}} expected-error {{attempt to use a deleted function}}
-    union { // expected-note {{default constructor of '' is implicitly deleted because field '' has a deleted default constructor}} \
-            // expected-note {{destructor of '' is implicitly deleted because}}
-      union { // expected-note {{default constructor of '' is implicitly deleted because field '' has a deleted default constructor}} \
-              // expected-note {{destructor of '' is implicitly deleted because}}
-        __weak id g1; // expected-note {{default constructor of '' is implicitly deleted because variant field 'g1' is an ObjC pointer}} \
-                      // expected-note {{destructor of '' is implicitly deleted because}}
+  static union { // expected-error {{call to implicitly-deleted default constructor of}}
+    union { // expected-note {{default constructor of '' is implicitly deleted because field '' has a deleted default constructor}}
+      union { // expected-note {{default constructor of '' is implicitly deleted because field '' has a deleted default constructor}}
+        __weak id g1; // expected-note {{default constructor of '' is implicitly deleted because variant field 'g1' is an ObjC pointer}}
         int g2;
       };
       int g3;
@@ -209,13 +205,13 @@
   };
 
   void testDefaultConstructor() {
-    U0 t0; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-    U1 t1; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+    U0 t0; // expected-error {{call to implicitly-deleted default constructor}}
+    U1 t1; // expected-error {{call to implicitly-deleted default constructor}}
     U2 t2;
     U3 t3;
-    S0 t4; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-    S1 t5; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-    S2 t6; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+    S0 t4; // expected-error {{call to implicitly-deleted default constructor}}
+    S1 t5; // expected-error {{call to implicitly-deleted default constructor}}
+    S2 t6; // expected-error {{call to implicitly-deleted default constructor}}
   }
 
   void testDestructor(U0 *u0, U1 *u1, U2 *u2, U3 *u3, S0 *s0, S1 *s1, S2 *s2) {
Index: clang/test/SemaCXX/virtual-base-used.cpp
===================================================================
--- clang/test/SemaCXX/virtual-base-used.cpp
+++ clang/test/SemaCXX/virtual-base-used.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s
-// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s
-// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s
-// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s
-// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s
-// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -triple %itanium_abi_triple -verify %s
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s
 // PR7800
 
 // The Microsoft ABI doesn't have the concept of key functions, so we have different
@@ -40,7 +40,6 @@
   // expected-note@-7 {{destructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
 #ifdef MSABI
   // expected-note@-9 {{default constructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
-  // expected-note@-10 {{destructor of 'B' is implicitly deleted}}
 #endif
 #endif
 };
@@ -60,10 +59,6 @@
   ~D();
 #if __cplusplus >= 201103L
   //expected-error@-2 {{non-deleted function '~D' cannot override a deleted function}}
-#ifdef MSABI
-//expected-error@-4 {{use a deleted function}}
-#else
-#endif
 #endif
 };
 
@@ -73,7 +68,6 @@
 // expected-note@-2 2{{implicit default constructor for 'D' first required here}}
 #else
 // expected-error@-4 {{call to implicitly-deleted default constructor of 'D'}}
-// expected-note@-5 {{implicit destructor for 'D' first required here}}
 #endif
 #else
 void D::foo() {
@@ -98,7 +92,6 @@
   // expected-note@-7 {{destructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
 #ifdef MSABI
   // expected-note@-9 {{default constructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
-  // expected-note@-10 {{destructor of 'E' is implicitly deleted}}
 #endif
 #endif
 };
@@ -113,7 +106,6 @@
 // expected-note@-7 {{overridden virtual function is here}}
 #ifdef MSABI
 // expected-note@-9 {{default constructor of 'F' is implicitly deleted because base class 'E' has a deleted default constructor}}
-// expected-note@-10 {{destructor of 'F' is implicitly deleted}}
 #endif
 #endif
 };
@@ -133,9 +125,6 @@
   ~G();
 #if __cplusplus >= 201103L
   //expected-error@-2 {{non-deleted function '~G' cannot override a deleted function}}
-#ifdef MSABI
-  //expected-error@-4 {{use a deleted function}}
-#endif
 #endif
 };
 
@@ -145,7 +134,6 @@
 // expected-note@-2 2{{implicit default constructor for 'G' first required here}}
 #else
 // expected-error@-4 {{call to implicitly-deleted default constructor of 'G'}}
-// expected-note@-5 {{mplicit destructor for 'G' first required here}}
 #endif
 #else
 void G::foo() {
@@ -171,7 +159,6 @@
   // expected-note@-7 {{destructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor}}
 #ifdef MSABI
   // expected-note@-9 {{default constructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor}}
-  // expected-note@-10 {{destructor of 'H' is implicitly deleted}}
 #endif
 #endif
 };
@@ -201,11 +188,6 @@
 
   virtual void foo();
   ~J();
-#ifdef MSABI
-#if __cplusplus >= 201103L
-//expected-error@-3 {{use a deleted function}}
-#endif
-#endif
 };
 
 #ifdef MSABI
@@ -214,7 +196,6 @@
 // expected-note@-2 2{{implicit default constructor for 'J' first required here}}
 #else
 // expected-error@-4 {{call to implicitly-deleted default constructor of 'J'}}
-// expected-note@-5 {{implicit destructor for 'J' first required here}}
 #endif
 
 #else
Index: clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
===================================================================
--- clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
+++ clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -frecovery-ast -std=c++11 -fsyntax-only -verify %s
 
 struct non_trivial {
   non_trivial();
@@ -8,9 +8,9 @@
 };
 
 union bad_union {
-  non_trivial nt; // expected-note {{non-trivial default constructor}} expected-note {{destructor of 'bad_union' is implicitly deleted}}
+  non_trivial nt; // expected-note {{non-trivial default constructor}}
 };
-bad_union u; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+bad_union u; // expected-error {{call to implicitly-deleted default constructor}}
 union bad_union2 { // expected-note {{all data members are const-qualified}}
   const int i;
 };
@@ -18,10 +18,10 @@
 
 struct bad_anon {
   union {
-    non_trivial nt; // expected-note {{non-trivial default constructor}} expected-note {{destructor of 'bad_anon' is implicitly deleted}}
+    non_trivial nt; // expected-note {{non-trivial default constructor}}
   };
 };
-bad_anon a; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+bad_anon a; // expected-error {{call to implicitly-deleted default constructor}}
 struct bad_anon2 {
   union { // expected-note {{all data members of an anonymous union member are const-qualified}}
     const int i;
@@ -62,7 +62,7 @@
   no_default() = delete; // expected-note 5{{deleted here}}
 };
 struct no_dtor {
-  ~no_dtor() = delete; // expected-note 4{{deleted here}}
+  ~no_dtor() = delete; // expected-note 2{{deleted here}}
 };
 
 struct bad_field_default {
@@ -74,12 +74,12 @@
 bad_base_default bbd; // expected-error {{call to implicitly-deleted default constructor}}
 
 struct bad_field_dtor {
-  no_dtor nd; // expected-note {{field 'nd' has a deleted destructor}} expected-note {{destructor of 'bad_field_dtor' is implicitly deleted }}
+  no_dtor nd; // expected-note {{field 'nd' has a deleted destructor}}
 };
-bad_field_dtor bfx; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct bad_base_dtor : no_dtor { // expected-note {{base class 'no_dtor' has a deleted destructor}} expected-note {{destructor of 'bad_base_dtor' is implicitly deleted}}
+bad_field_dtor bfx; // expected-error {{call to implicitly-deleted default constructor}}
+struct bad_base_dtor : no_dtor { // expected-note {{base class 'no_dtor' has a deleted destructor}}
 };
-bad_base_dtor bbx; // expected-error {{call to implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+bad_base_dtor bbx; // expected-error {{call to implicitly-deleted default constructor}}
 
 struct ambiguous_default {
   ambiguous_default();
Index: clang/test/CXX/special/class.ctor/p5-0x.cpp
===================================================================
--- clang/test/CXX/special/class.ctor/p5-0x.cpp
+++ clang/test/CXX/special/class.ctor/p5-0x.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wno-defaulted-function-deleted
+// RUN: %clang_cc1 -frecovery-ast -fsyntax-only -verify %s -std=c++11 -Wno-defaulted-function-deleted
 
 struct DefaultedDefCtor1 {};
 struct DefaultedDefCtor2 { DefaultedDefCtor2() = default; };
 struct DeletedDefCtor { DeletedDefCtor() = delete; DeletedDefCtor(int); }; // expected-note {{explicitly marked deleted here}}
 class PrivateDefCtor { PrivateDefCtor() = default; public: PrivateDefCtor(int); };
-struct DeletedDtor { ~DeletedDtor() = delete; }; // expected-note 8{{explicitly marked deleted here}}
+struct DeletedDtor { ~DeletedDtor() = delete; }; // expected-note 4{{explicitly marked deleted here}}
 class PrivateDtor { ~PrivateDtor() = default; };
 class Friend {
   Friend() = default; ~Friend() = default;
@@ -122,22 +122,22 @@
 // - any direct or virtual base class or non-static data member has a type with
 // a destructor that is deleted or inaccessible from the defaulted default
 // constructor.
-struct Deleted7a : DeletedDtor {}; // expected-note 2{{because base class 'DeletedDtor' has a deleted destructor}}
-Deleted7a d7a; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7b : virtual DeletedDtor {}; // expected-note 2{{because base class 'DeletedDtor' has a deleted destructor}}
-Deleted7b d7b; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7c { DeletedDtor a; }; // expected-note 2{{because field 'a' has a deleted destructor}}
-Deleted7c d7c; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7d { DeletedDtor a = {}; }; // expected-note 2{{because field 'a' has a deleted destructor}}
-Deleted7d d7d; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7e : PrivateDtor {}; // expected-note 2{{base class 'PrivateDtor' has an inaccessible destructor}}
-Deleted7e d7e; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7f : virtual PrivateDtor {}; // expected-note 2{{base class 'PrivateDtor' has an inaccessible destructor}}
-Deleted7f d7f; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7g { PrivateDtor a; }; // expected-note 2{{field 'a' has an inaccessible destructor}}
-Deleted7g d7g; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
-struct Deleted7h { PrivateDtor a = {}; }; // expected-note 2{{field 'a' has an inaccessible destructor}}
-Deleted7h d7h; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+struct Deleted7a : DeletedDtor {}; // expected-note {{because base class 'DeletedDtor' has a deleted destructor}}
+Deleted7a d7a; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7b : virtual DeletedDtor {}; // expected-note {{because base class 'DeletedDtor' has a deleted destructor}}
+Deleted7b d7b; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7c { DeletedDtor a; }; // expected-note {{because field 'a' has a deleted destructor}}
+Deleted7c d7c; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7d { DeletedDtor a = {}; }; // expected-note {{because field 'a' has a deleted destructor}}
+Deleted7d d7d; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7e : PrivateDtor {}; // expected-note {{base class 'PrivateDtor' has an inaccessible destructor}}
+Deleted7e d7e; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7f : virtual PrivateDtor {}; // expected-note {{base class 'PrivateDtor' has an inaccessible destructor}}
+Deleted7f d7f; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7g { PrivateDtor a; }; // expected-note {{field 'a' has an inaccessible destructor}}
+Deleted7g d7g; // expected-error {{implicitly-deleted default constructor}}
+struct Deleted7h { PrivateDtor a = {}; }; // expected-note {{field 'a' has an inaccessible destructor}}
+Deleted7h d7h; // expected-error {{implicitly-deleted default constructor}}
 struct NotDeleted7i : Friend {};
 NotDeleted7i d7i;
 struct NotDeleted7j : virtual Friend {};
Index: clang/test/CXX/class.access/p4.cpp
===================================================================
--- clang/test/CXX/class.access/p4.cpp
+++ clang/test/CXX/class.access/p4.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s
-// RUN: %clang_cc1 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
-// RUN: %clang_cc1 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-compatibility-version=19 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-compatibility-version=19 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-compatibility-version=19 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -frecovery-ast -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -frecovery-ast -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -frecovery-ast -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -frecovery-ast -triple x86_64-windows-msvc -fms-compatibility-version=19 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -frecovery-ast -triple x86_64-windows-msvc -fms-compatibility-version=19 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -frecovery-ast -triple x86_64-windows-msvc -fms-compatibility-version=19 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
 
 // C++0x [class.access]p4:
 
@@ -220,14 +220,14 @@
   };
 
   class Derived3 :
-    Base<0>, // expected-note 2{{deleted because base class 'Base<0>' has an inaccessible destructor}}
+    Base<0>, // expected-note {{deleted because base class 'Base<0>' has an inaccessible destructor}}
     virtual Base<1>,
     Base2,
     virtual Base3
   {};
-  Derived3 d3; // expected-error {{implicitly-deleted default constructor}} expected-error {{attempt to use a deleted function}}
+  Derived3 d3; // expected-error {{implicitly-deleted default constructor}}
 #elif __cplusplus >= 201103L && defined(_MSC_VER)
-  template <unsigned N> class Base { ~Base(); }; // expected-note 9{{declared private here}}
+  template <unsigned N> class Base { ~Base(); }; // expected-note 6{{declared private here}}
   // expected-error@+1 {{inherited virtual base class 'Base<2>' has private destructor}}
   class Base2 : virtual Base<2> { ~Base2(); }; // expected-note 1{{declared private here}}
   // expected-error@+1 {{inherited virtual base class 'Base<3>' has private destructor}}
@@ -249,15 +249,13 @@
     ~Derived2() {}
   };
 
-  class Derived3 : // expected-error 3{{has private destructor}}
+  class Derived3 :
     Base<0>, // expected-note {{deleted because base class 'Base<0>' has an inaccessible destructor}}
-             // expected-note@-1 {{destructor of 'Derived3' is implicitly deleted}}
     virtual Base<1>,
     Base2,
     virtual Base3
   {};
-  Derived3 d3; // expected-error {{implicitly-deleted default constructor}} expected-error {{use a deleted function}}
-               // expected-note@-1 {{implicit destructor for}}
+  Derived3 d3; // expected-error {{implicitly-deleted default constructor}}
 #else
 #error "missing case of MSVC cross C++ versions"
 #endif
Index: clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -15003,6 +15003,8 @@
 
 void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
   if (VD->isInvalidDecl()) return;
+  if (VD->getInit() && VD->getInit()->containsErrors())
+    return;
 
   CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Record->getDecl());
   if (ClassDecl->isInvalidDecl()) return;
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12554,12 +12554,17 @@
     InitializationSequence InitSeq(*this, Entity, Kind, None);
     ExprResult Init = InitSeq.Perform(*this, Entity, Kind, None);
 
-    // If default-init fails, leave var uninitialized but valid, for recovery.
-
     if (Init.get()) {
       Var->setInit(MaybeCreateExprWithCleanups(Init.get()));
       // This is important for template substitution.
       Var->setInitStyle(VarDecl::CallInit);
+    } else if (Init.isInvalid()) {
+      // If default-init fails, leave var uninitialized but valid, and build
+      // a recovery-expr for recovery.
+      auto RecoveryExpr =
+          CreateRecoveryExpr(Var->getLocation(), Var->getEndLoc(), {});
+      if (RecoveryExpr.get())
+        Var->setInit(RecoveryExpr.get());
     }
 
     CheckCompleteVariableDeclaration(Var);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to