[llvm-branch-commits] [cfe-branch] r339236 - Merging r339210:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 8 05:06:21 PDT 2018


Author: hans
Date: Wed Aug  8 05:06:21 2018
New Revision: 339236

URL: http://llvm.org/viewvc/llvm-project?rev=339236&view=rev
Log:
Merging r339210:
------------------------------------------------------------------------
r339210 | rsmith | 2018-08-08 02:42:42 +0200 (Wed, 08 Aug 2018) | 2 lines

PR38286: Don't crash when attempting to define a constructor for an
incomplete class template.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_70/   (props changed)
    cfe/branches/release_70/lib/Sema/SemaExprCXX.cpp
    cfe/branches/release_70/test/SemaCXX/constructor.cpp

Propchange: cfe/branches/release_70/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug  8 05:06:21 2018
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:338552-338553,338602,338627,338749,338942,339128,339170
+/cfe/trunk:338552-338553,338602,338627,338749,338942,339128,339170,339210
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_70/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/lib/Sema/SemaExprCXX.cpp?rev=339236&r1=339235&r2=339236&view=diff
==============================================================================
--- cfe/branches/release_70/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/release_70/lib/Sema/SemaExprCXX.cpp Wed Aug  8 05:06:21 2018
@@ -113,9 +113,15 @@ ParsedType Sema::getConstructorName(Iden
       break;
     }
   }
-  if (!InjectedClassName && CurClass->isInvalidDecl())
+  if (!InjectedClassName) {
+    if (!CurClass->isInvalidDecl()) {
+      // FIXME: RequireCompleteDeclContext doesn't check dependent contexts
+      // properly. Work around it here for now.
+      Diag(SS.getLastQualifierNameLoc(),
+           diag::err_incomplete_nested_name_spec) << CurClass << SS.getRange();
+    }
     return ParsedType();
-  assert(InjectedClassName && "couldn't find injected class name");
+  }
 
   QualType T = Context.getTypeDeclType(InjectedClassName);
   DiagnoseUseOfDecl(InjectedClassName, NameLoc);

Modified: cfe/branches/release_70/test/SemaCXX/constructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/test/SemaCXX/constructor.cpp?rev=339236&r1=339235&r2=339236&view=diff
==============================================================================
--- cfe/branches/release_70/test/SemaCXX/constructor.cpp (original)
+++ cfe/branches/release_70/test/SemaCXX/constructor.cpp Wed Aug  8 05:06:21 2018
@@ -86,3 +86,14 @@ A::S::operator int() { return 1; }
 
 A::S::~S() {}
 
+namespace PR38286 {
+  // FIXME: It'd be nice to give more consistent diagnostics for these cases
+  // (but they're all failing for somewhat different reasons...).
+  template<typename> struct A;
+  template<typename T> A<T>::A() {} // expected-error {{incomplete type 'A' named in nested name specifier}}
+  /*FIXME: needed to recover properly from previous error*/;
+  template<typename> struct B;
+  template<typename T> void B<T>::f() {} // expected-error {{out-of-line definition of 'f' from class 'B<type-parameter-0-0>'}}
+  template<typename> struct C;
+  template<typename T> C<T>::~C() {} // expected-error {{no type named 'C' in 'C<type-parameter-0-0>'}}
+}




More information about the llvm-branch-commits mailing list