Skip to content

MSVC 145 (VS2026) fails to compile with internal compiler error. #81

Description

@Agrael1

Hello, thank you for the library!

I have an issue building under new Visual Studio 2026. It results in internal compiler error.
The problem is caused by constexpr variables inside function that are not static.

e.g.:

[[nodiscard]] constexpr auto type_name() noexcept -> std::string_view
{
    constexpr std::string_view function_name = std::source_location::current().function_name();
    static_assert(std::size(function_name) > 0u); // not static, local lifetime

    return [&] {
        static constexpr const auto name = reflect::fixed_string<char, std::size(function_name)>{
            function_name
        };
        return std::string_view{ name };
    }();
}

If I require the variable to be static, then it compiles fine.

[[nodiscard]] constexpr auto type_name() noexcept -> std::string_view
{
    constexpr static std::string_view function_name = std::source_location::current().function_name();
    static_assert(std::size(function_name) > 0u); // static, global lifetime

    return [&] {
        static constexpr const auto name = reflect::fixed_string<char, std::size(function_name)>{
            function_name
        };
        return std::string_view{ name };
    }();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions