<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 February 2017 at 11:39, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">IIUC, this is a follow-up to r291955, which was merged to 4.0. Should<br>
this one be merged also?<br></blockquote><div><br></div><div>Yes, please.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers,<br>
Hans<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Feb 14, 2017 at 8:18 PM, Richard Smith via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: rsmith<br>
> Date: Tue Feb 14 22:18:23 2017<br>
> New Revision: 295149<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=295149&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=295149&view=rev</a><br>
> Log:<br>
> Fix assertion failure due to implicit special member lookup lacking a source location.<br>
><br>
> Modified:<br>
>     cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp<br>
>     cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=295149&r1=295148&r2=295149&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaLookup.cpp?rev=295149&r1=<wbr>295148&r2=295149&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaLookup.<wbr>cpp Tue Feb 14 22:18:23 2017<br>
> @@ -2838,6 +2838,9 @@ Sema::<wbr>SpecialMemberOverloadResult *Sema:<br>
>      assert((SM != CXXDefaultConstructor && SM != CXXDestructor) &&<br>
>             "parameter-less special members can't have qualified arguments");<br>
><br>
> +  // FIXME: Get the caller to pass in a location for the lookup.<br>
> +  SourceLocation LookupLoc = RD->getLocation();<br>
> +<br>
>    llvm::FoldingSetNodeID ID;<br>
>    ID.AddPointer(RD);<br>
>    ID.AddInteger(SM);<br>
> @@ -2919,7 +2922,7 @@ Sema::<wbr>SpecialMemberOverloadResult *Sema:<br>
>        VK = VK_RValue;<br>
>    }<br>
><br>
> -  OpaqueValueExpr FakeArg(SourceLocation(), ArgType, VK);<br>
> +  OpaqueValueExpr FakeArg(LookupLoc, ArgType, VK);<br>
><br>
>    if (SM != CXXDefaultConstructor) {<br>
>      NumArgs = 1;<br>
> @@ -2933,13 +2936,13 @@ Sema::<wbr>SpecialMemberOverloadResult *Sema:<br>
>    if (VolatileThis)<br>
>      ThisTy.addVolatile();<br>
>    Expr::Classification Classification =<br>
> -    OpaqueValueExpr(<wbr>SourceLocation(), ThisTy,<br>
> +    OpaqueValueExpr(LookupLoc, ThisTy,<br>
>                      RValueThis ? VK_RValue : VK_LValue).Classify(Context);<br>
><br>
>    // Now we perform lookup on the name we computed earlier and do overload<br>
>    // resolution. Lookup is only performed directly into the class since there<br>
>    // will always be a (possibly implicit) declaration to shadow any others.<br>
> -  OverloadCandidateSet OCS(RD->getLocation(), OverloadCandidateSet::CSK_<wbr>Normal);<br>
> +  OverloadCandidateSet OCS(LookupLoc, OverloadCandidateSet::CSK_<wbr>Normal);<br>
>    DeclContext::lookup_result R = RD->lookup(Name);<br>
><br>
>    if (R.empty()) {<br>
> @@ -2994,7 +2997,7 @@ Sema::<wbr>SpecialMemberOverloadResult *Sema:<br>
>    }<br>
><br>
>    OverloadCandidateSet::iterator Best;<br>
> -  switch (OCS.BestViableFunction(*this, SourceLocation(), Best)) {<br>
> +  switch (OCS.BestViableFunction(*this, LookupLoc, Best)) {<br>
>      case OR_Success:<br>
>        Result->setMethod(cast<<wbr>CXXMethodDecl>(Best->Function)<wbr>);<br>
>        Result->setKind(<wbr>SpecialMemberOverloadResult::<wbr>Success);<br>
><br>
> Modified: cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp?rev=295149&r1=295148&r2=295149&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>SemaCXX/cxx11-inheriting-<wbr>ctors.cpp?rev=295149&r1=<wbr>295148&r2=295149&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/cxx11-<wbr>inheriting-ctors.cpp Tue Feb 14 22:18:23 2017<br>
> @@ -105,3 +105,31 @@ namespace PR31606 {<br>
>    // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}.<br>
>    bool b = A{} == B{}; // expected-error {{invalid operands}}<br>
>  }<br>
> +<br>
> +namespace implicit_member_srcloc {<br>
> +  template<class T><br>
> +  struct S3 {<br>
> +  };<br>
> +<br>
> +  template<class T><br>
> +  struct S2 {<br>
> +    S2(S3<T> &&);<br>
> +  };<br>
> +<br>
> +  template<class T><br>
> +  struct S1 : S2<T> {<br>
> +    using S2<T>::S2;<br>
> +    S1();<br>
> +  };<br>
> +<br>
> +  template<class T><br>
> +  struct S0 {<br>
> +    S0();<br>
> +    S0(S0&&) = default;<br>
> +    S1<T> m1;<br>
> +  };<br>
> +<br>
> +  void foo1() {<br>
> +    S0<int> s0;<br>
> +  }<br>
> +}<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>