https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102257
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to 康桓瑋 from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > See https://wg21.link/cwg1228 this might be invalid code and GCC is correct
> > in rejecting it.
>
> Maybe. But why does GCC accept the following?
>
> #include <tuple>
> #include <string>
>
> int main() {
> std::tuple<std::string, int> t{{}, {}};
> }
>
> https://godbolt.org/z/ePovjh3fa
Looks like we accept this testcase because the template parameter _Alloc for
the template candidate
template<typename _Alloc,
_ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> = true>
tuple(std::allocator_arg_t, const _Alloc&)
is no longer deducible (whereas in the original testcase _Alloc is deduced to
int here), so this candidate is discarded and the result of overload resolution
is no longer ambiguous.
(In reply to Andrew Pinski from comment #2)
> See https://wg21.link/cwg1228 this might be invalid code and GCC is correct
> in rejecting it.
Agreed FWIW