https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119247
Bug ID: 119247
Summary: accepts-invalid non-constexpr variable as template
argument in a lambda when used for another template
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: raul at tambre dot ee
Target Milestone: ---
Created attachment 60723
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60723&action=edit
Bug sample
The following
template<typename>
struct array;
template<auto variable>
using get_type = decltype(variable);
void foo()
{
auto lambda{[](auto variable)
{
using alias = array<get_type<variable>>;
}};
lambda(int{});
}
Clang and MSVC reject this as "non-type template argument is not a constant
expression".
Removing the array<> from get_type<variable> causes GCC to fail with the same
error.
Due to this I accidentally wrote that worked with GCC but not the others.