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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-10-01
                 CC|                            |jason at gcc dot gnu.org
      Known to work|                            |4.9.4
            Summary|SFINAE trait as template    |[6/7/8/9 Regression] SFINAE
                   |parameter causes incorrect  |trait as template parameter
                   |application of trait to     |causes incorrect
                   |other areas                 |application of trait to
                   |                            |other areas
     Ever confirmed|0                           |1
      Known to fail|                            |5.5.0, 6.4.0, 7.3.0, 8.2.0,
                   |                            |9.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

struct A {};
struct B {};

template <typename T> struct wrapper {};

template <typename> struct enable_if_A { };
template<> struct enable_if_A<A> { using type = void; };

template <typename T, typename = typename enable_if_A<T>::type> using ok_t = T;

template <typename T> void not_even_called(wrapper<const ok_t<T>&> a);

template <typename T> int called(wrapper<const T&> a);

void test(wrapper<const B&>& val)
{
    called(val);
}


87366.cc: In function 'void test(wrapper<const B&>&)':
87366.cc:17:15: error: no matching function for call to 'called(wrapper<const
B&>&)'
17 |     called(val);
   |               ^
87366.cc:13:27: note: candidate: 'template<class T> int
called(wrapper<ok_t<T>&>)'
13 | template <typename T> int called(wrapper<const T&> a);
   |                           ^~~~~~
87366.cc:13:27: note:   template argument deduction/substitution failed:
87366.cc: In substitution of 'template<class T> int called(wrapper<ok_t<T>&>)
[with T = B]':
87366.cc:17:15:   required from here
87366.cc:13:27: error: no type named 'type' in 'struct enable_if_A<B>'


This was accepted prior to gcc-5, it started to be rejected with r217250:

            DR 1558
            * pt.c (dependent_alias_template_spec_p): New.
            (dependent_type_p_r): Handle dependent alias template
specialization.
            (template_args_equal): A dependent alias template specializations
            is not equal to its underlying type as a template argument.
            * tree.c (strip_typedefs): Don't strip a dependent alias
            template-id.

Reply via email to