https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123998
Bug ID: 123998
Summary: [reflection] invalid template splice not rejected
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: ---
This is tested in splice5.C.
```
void foo (int);
template <int N>
void
qux ()
{
template [: N == 0 ? ^^foo : ^^:: :] (0); // invalid
}
void
corge ()
{
qux <0> ();
}
```
because foo isn't a template. The problem is that in tsubst_splice_expr we
don't know that there was a 'template' and so we don't emit the same error as
in cp_parser_splice_expression. I think we're going to need
SPLICE_EXPR_TEMPLATE_P.