[PATCH] [ms] Don't try to delay lookup for lookup or overload resolution failures in SFINAE context (PR23823)

Richard Smith richard at metafoo.co.uk
Fri Jun 12 12:47:01 PDT 2015


LGTM

On Fri, Jun 12, 2015 at 12:46 PM, Hans Wennborg <hans at chromium.org> wrote:

> Hi rnk, rsmith, majnemer,
>
> The underlying problem in PR23823 already existed before my recent change
> in r239558, but that change made it worse (failing not only for undeclared
> symbols, but also failed overload resolution). This makes us not try to
> delay the lookup in SFINAE context. I assume no current code is relying on
> SFINAE working with lookups that need to be delayed, because that never
> seems to have worked :-)
>
> Please take a look!
>
> http://reviews.llvm.org/D10417
>
> Files:
>   lib/Sema/SemaOverload.cpp
>   test/SemaTemplate/ms-lookup-template-base-classes.cpp
>
> Index: lib/Sema/SemaOverload.cpp
> ===================================================================
> --- lib/Sema/SemaOverload.cpp
> +++ lib/Sema/SemaOverload.cpp
> @@ -10750,7 +10750,8 @@
>    // functions, including those from argument-dependent lookup.
>    AddOverloadedCallCandidates(ULE, Args, *CandidateSet);
>
> -  if (getLangOpts().MSVCCompat && CurContext->isDependentContext() &&
> +  if (getLangOpts().MSVCCompat &&
> +      CurContext->isDependentContext() && !isSFINAEContext() &&
>        (isa<FunctionDecl>(CurContext) || isa<CXXRecordDecl>(CurContext))) {
>
>      OverloadCandidateSet::iterator Best;
> Index: test/SemaTemplate/ms-lookup-template-base-classes.cpp
> ===================================================================
> --- test/SemaTemplate/ms-lookup-template-base-classes.cpp
> +++ test/SemaTemplate/ms-lookup-template-base-classes.cpp
> @@ -563,3 +563,13 @@
>    x.member(); // expected-note{{requested here}}
>  };
>  }
> +
> +namespace PR23823 {
> +// Don't delay lookup in SFINAE context.
> +template <typename T> decltype(g(T())) check(); //
> expected-note{{candidate template ignored: substitution failure [with T =
> int]: use of undeclared identifier 'g'}}
> +decltype(check<int>()) x; // expected-error{{no matching function for
> call to 'check'}}
> +
> +void h();
> +template <typename T> decltype(h(T())) check2(); //
> expected-note{{candidate template ignored: substitution failure [with T =
> int]: no matching function for call to 'h'}}
> +decltype(check2<int>()) y; // expected-error{{no matching function for
> call to 'check2'}}
> +}
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150612/7bb54746/attachment.html>


More information about the cfe-commits mailing list