-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
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
Labels
No labels