Open
Description
https://godbolt.org/z/cGsG8T4G7
template<typename T, typename = void>
struct Widget;
template <class T>
struct Widget<T, decltype(T::test2([](){}))>
{
};
struct Baz
{
template<typename F>
static constexpr decltype(auto) test2(F&& f) {}
};
void test()
{
Widget<Baz> w;
}
Similar issue as #115990 which is fixed here #117845.
test2
must be instantiated since it has a deduced return type. The instantiation of the lambda is within the context of the uninstantiated Widget template. CodeGen has no way to know that a template argument is defined inside an uninstantiated template. So the function get put into DeferredDecls
which is keyed off of the mangled name of the function so we need to mangle the decltype
.