Skip to content

[clang-cl] Cannot mangle decltype when used in an unevaluated context #118241

Open
@MaxEW707

Description

@MaxEW707

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions