https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123640
Bug ID: 123640
Summary: [reflection] wrong "unparenthesized splice expression"
error
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
```
#include <meta>
template<class T>
constexpr std::size_t field_count{ std::meta::nonstatic_data_members_of(^^T,
std::meta::access_context::unchecked()).size() };
template<std::size_t index, class T>
constexpr std::meta::info field_at{ std::meta::nonstatic_data_members_of(^^T,
std::meta::access_context::unchecked())[index] };
struct S
{
int a, b, c;
constexpr bool operator<(this auto&&l, auto&&r)noexcept
{
using T = std::remove_cvref_t<decltype(l)>;
static constexpr auto N{field_count<T>};
if constexpr(N == 0)return false;
else
{
template for (constexpr auto i :
std::make_index_sequence<N - 1>{})
if(l.[:field_at<i,T>:] != r.[:field_at<i,T>:])[[likely]]
return l.[:field_at<i,T>:] < r.[:field_at<i,T>:];
return l.[:field_at<N - 1, T>:] < r.[:field_at<N - 1,
T>:];
}
}
};
int main()
{
return S{1,2,3} < S{1,3,2};
}
```
doesn't compile due to:
error: unparenthesized splice expression cannot be used as a template argument
which looks bogus.