IIUC, this is a follow-up to r291955, which was merged to 4.0. Should this one be merged also?
Cheers, Hans On Tue, Feb 14, 2017 at 8:18 PM, Richard Smith via cfe-commits <cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Tue Feb 14 22:18:23 2017 > New Revision: 295149 > > URL: http://llvm.org/viewvc/llvm-project?rev=295149&view=rev > Log: > Fix assertion failure due to implicit special member lookup lacking a source > location. > > Modified: > cfe/trunk/lib/Sema/SemaLookup.cpp > cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp > > Modified: cfe/trunk/lib/Sema/SemaLookup.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=295149&r1=295148&r2=295149&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaLookup.cpp (original) > +++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Feb 14 22:18:23 2017 > @@ -2838,6 +2838,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); > @@ -2919,7 +2922,7 @@ Sema::SpecialMemberOverloadResult *Sema: > VK = VK_RValue; > } > > - OpaqueValueExpr FakeArg(SourceLocation(), ArgType, VK); > + OpaqueValueExpr FakeArg(LookupLoc, ArgType, VK); > > if (SM != CXXDefaultConstructor) { > NumArgs = 1; > @@ -2933,13 +2936,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()) { > @@ -2994,7 +2997,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/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp?rev=295149&r1=295148&r2=295149&view=diff > ============================================================================== > --- cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp (original) > +++ cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp Tue Feb 14 22:18:23 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; > + } > +} > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits