https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128289
Bug ID: 128289
Summary: GCC doesn't recognize CTAD with expression-list in
overloaded idiom
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ixsci at pm dot me
Target Milestone: ---
GCC correctly compiles this:
template<typename... T>
struct overloaded: T...
{
using T::operator()...;
};
void fun(auto callable)
{}
int main()
{
fun(overloaded{[](int){}, [](std::string){}});
}
But if I change overloaded call from curly braces to parens it will fail to
compile:
int main()
{
fun(overloaded([](int){}, [](std::string){}));
}
Godbolt with fail-case: https://gcc.godbolt.org/z/5aPraWofE