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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
My current theory is that it is not a bug.

While processing "decltype(aa<h>(0))" we look for a suitable aa candidate, and
thanks to C++20 paren-init "g(0)" in "decltype(g(0))" succeeds.  Then we select
 aa(int) rather than aa(...) and due to various SFINAEs we end up choosing the
explicit k(l) constructor.  In C++17 the paren-init doesn't kick in and we
select "k(...)".  So in C++20 when actually converting {0} to S we hit:

 7426         /* When converting from an init list we consider explicit
 7427            constructors, but actually trying to call one is an error.  */

(DR 1518 + DR 1630)

This fails in C++17 too when

template <class g, class = decltype(g(0))> f aa(int);

is changed to

template <class g, class = decltype(g{0})> f aa(int);

Reply via email to