On 2025-10-06 20:38, Patrick Palka wrote:
Some context:

GCC represents templated and non-templated expressions differently, and
the processing_template_decl flag controls whether our assorted semantic
analysis and AST building functions should produce a templated vs
non-templated tree.  And we naturally want to produce templated trees
when parsing a template, hence the flag's name -- although there's other
non-parsing situations where we want to produce templated trees such as
during partial instantiation, so the flag's name is imprecise nowadays.

An alternative fix would be to make tsubst_expr (our main expression
instantiation routine) diagnose such calls at instantiation time, but
it's sufficient and better to diagnose errors inside templates sooner if
possible, i.e. at parse time vs at instantiation time (this is allowed
by https://eel.is/c++draft/temp.res.general#6)

Thanks for the review! I also considered adding a diagnostic in
tsubst_expr, but the assertion there mentioned it should be checked
earlier, and it seemed to make more sense to deal with it at parse time.

Can you strengthen this testcase by not instantiating/using the function
template (ensuring we diagnose the error at parse time)?  Also, can you
further minimize the size of the testcase by defining a dummy concept
instead of including <concepts>?

I'll update the test and and submit another patch later.

Reply via email to