Consider this piece of code:
template < auto What >
constexpr auto Identity = [](auto&&...) { return What; };
struct Ban
{
Ban() = default;
Ban(const Ban& ban) = delete;
Ban( Ban&& ban) = delete;
};
int main()
{
Ban ban;
Identity<false>(10,ban);
return 0;
}
This fails to compile on godbolt.org with gcc-7.3
as it tries to copy the second argument of Identity
. Why it should? Is this a bug in gcc
?
gcc
does not complain if the second argument is a temporary or when there is only one argument. It complains for only one argument when the definition of Identity
is with (...)
instead of (auto&&...)
.