Consider the following variadic class template:
template <typename... Ts>
struct foo
{
template <typename... Us>
foo(Us...) { }
};
If I try to instantiate foo
in the following way, both g++(trunk) and clang++(trunk) are happy:
auto o = foo{};
As soon as I switch to value-initialization with parentheses, g++ fails to compile (while clang++ is still happy):
auto o = foo();
error: cannot deduce template arguments for 'foo' from () auto o = foo(); ^
Is this a g++ bug, or is there a difference in the way class template argument deduction is handled between
{}
and ()
initialization?
This also happens with a proper deduction guide: https://godbolt.org/g/qReXpM.