https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12672

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-04-16 16:42:54         |2016-1-15

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Wolfgang Bangerth from comment #4)
> Confirmed. Here's something even shorter:
> ---------------------------
> template <typename T> struct S {
>     typedef typename T::type type;
> };
> 
> template<typename U, typename V = typename S<U>::type>
> struct A {};
> 
> template<typename T> A<T> Foo(T);
> template<typename T> void Foo(T, T);
> 
> int main() {
>   Foo<int>(1, 2);
> }
> ----------------------------
> This fails to compile because the compiler tries to instantiate
> the return type of the first Foo function. Whether that is actually
> taken is irrelevant here, since we are only doing name lookup at this
> stage, but we shouldn't error out: this is a SFINAE failure and
> should just remove the first Foo function from the list of candidates.
> It shouldn't be an error.

I disagree, the error is not in the immediate context, so SFINAE doesn't apply.

Clang does accept it though, maybe it doesn't instantiate the return type
during name lookup? Not sure.

Reply via email to