[llvm-branch-commits] [cfe-branch] r295233 - Merging r295149:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 15 12:49:40 PST 2017


Author: hans
Date: Wed Feb 15 14:49:39 2017
New Revision: 295233

URL: http://llvm.org/viewvc/llvm-project?rev=295233&view=rev
Log:
Merging r295149:
------------------------------------------------------------------------
r295149 | rsmith | 2017-02-14 20:18:23 -0800 (Tue, 14 Feb 2017) | 2 lines

Fix assertion failure due to implicit special member lookup lacking a source location.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_40/   (props changed)
    cfe/branches/release_40/lib/Sema/SemaLookup.cpp
    cfe/branches/release_40/test/SemaCXX/cxx11-inheriting-ctors.cpp

Propchange: cfe/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 15 14:49:39 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291963-291964,292032,292052,292183,292194,292247,292265,292497,292555,292558-292559,292561,292590,292800,292847,292874,292991,293043,293134,293360,293369,293596,293678,293787,294008,294800,294855
+/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291963-291964,292032,292052,292183,292194,292247,292265,292497,292555,292558-292559,292561,292590,292800,292847,292874,292991,293043,293134,293360,293369,293596,293678,293787,294008,294800,294855,295149
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_40/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_40/lib/Sema/SemaLookup.cpp?rev=295233&r1=295232&r2=295233&view=diff
==============================================================================
--- cfe/branches/release_40/lib/Sema/SemaLookup.cpp (original)
+++ cfe/branches/release_40/lib/Sema/SemaLookup.cpp Wed Feb 15 14:49:39 2017
@@ -2831,6 +2831,9 @@ Sema::SpecialMemberOverloadResult *Sema:
     assert((SM != CXXDefaultConstructor && SM != CXXDestructor) &&
            "parameter-less special members can't have qualified arguments");
 
+  // FIXME: Get the caller to pass in a location for the lookup.
+  SourceLocation LookupLoc = RD->getLocation();
+
   llvm::FoldingSetNodeID ID;
   ID.AddPointer(RD);
   ID.AddInteger(SM);
@@ -2912,7 +2915,7 @@ Sema::SpecialMemberOverloadResult *Sema:
       VK = VK_RValue;
   }
 
-  OpaqueValueExpr FakeArg(SourceLocation(), ArgType, VK);
+  OpaqueValueExpr FakeArg(LookupLoc, ArgType, VK);
 
   if (SM != CXXDefaultConstructor) {
     NumArgs = 1;
@@ -2926,13 +2929,13 @@ Sema::SpecialMemberOverloadResult *Sema:
   if (VolatileThis)
     ThisTy.addVolatile();
   Expr::Classification Classification =
-    OpaqueValueExpr(SourceLocation(), ThisTy,
+    OpaqueValueExpr(LookupLoc, ThisTy,
                     RValueThis ? VK_RValue : VK_LValue).Classify(Context);
 
   // Now we perform lookup on the name we computed earlier and do overload
   // resolution. Lookup is only performed directly into the class since there
   // will always be a (possibly implicit) declaration to shadow any others.
-  OverloadCandidateSet OCS(RD->getLocation(), OverloadCandidateSet::CSK_Normal);
+  OverloadCandidateSet OCS(LookupLoc, OverloadCandidateSet::CSK_Normal);
   DeclContext::lookup_result R = RD->lookup(Name);
 
   if (R.empty()) {
@@ -2987,7 +2990,7 @@ Sema::SpecialMemberOverloadResult *Sema:
   }
 
   OverloadCandidateSet::iterator Best;
-  switch (OCS.BestViableFunction(*this, SourceLocation(), Best)) {
+  switch (OCS.BestViableFunction(*this, LookupLoc, Best)) {
     case OR_Success:
       Result->setMethod(cast<CXXMethodDecl>(Best->Function));
       Result->setKind(SpecialMemberOverloadResult::Success);

Modified: cfe/branches/release_40/test/SemaCXX/cxx11-inheriting-ctors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_40/test/SemaCXX/cxx11-inheriting-ctors.cpp?rev=295233&r1=295232&r2=295233&view=diff
==============================================================================
--- cfe/branches/release_40/test/SemaCXX/cxx11-inheriting-ctors.cpp (original)
+++ cfe/branches/release_40/test/SemaCXX/cxx11-inheriting-ctors.cpp Wed Feb 15 14:49:39 2017
@@ -105,3 +105,31 @@ namespace PR31606 {
   // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}.
   bool b = A{} == B{}; // expected-error {{invalid operands}}
 }
+
+namespace implicit_member_srcloc {
+  template<class T>
+  struct S3 {
+  };
+
+  template<class T>
+  struct S2 {
+    S2(S3<T> &&);
+  };
+
+  template<class T>
+  struct S1 : S2<T> {
+    using S2<T>::S2;
+    S1();
+  };
+
+  template<class T>
+  struct S0 {
+    S0();
+    S0(S0&&) = default;
+    S1<T> m1;
+  };
+
+  void foo1() {
+    S0<int> s0;
+  }
+}




More information about the llvm-branch-commits mailing list