]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/reflection: ICE with missing OVERLOAD [PR124150]
authorMarek Polacek <polacek@redhat.com>
Tue, 17 Feb 2026 22:08:52 +0000 (17:08 -0500)
committerMarek Polacek <polacek@redhat.com>
Mon, 23 Feb 2026 15:38:17 +0000 (10:38 -0500)
commit99b63e4ac7ee06e2f5030b72dc876bf35e9842ca
tree3aa06b25d5610fc7b2b7baaf6e51fec51ff1386b
parent23a80bd08ffaaf2260a499d828d63d001e1d634c
c++/reflection: ICE with missing OVERLOAD [PR124150]

A function template is supposed to be wrapped in an OVERLOAD.  Since
in certain cases like members_of it is not, splice makes sure to add
the OVERLOAD if needed.  But it wasn't looking into TEMPLATE_ID_EXPRs
and so we ended up with a "naked" TEMPLATE_DECL and crashed.

We can add the missing OVERLOAD in eval_substitute.

PR c++/124150

gcc/cp/ChangeLog:

* reflect.cc (eval_substitute): Add an OVERLOAD around
a DECL_FUNCTION_TEMPLATE_P.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/substitute4.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/reflect.cc
gcc/testsuite/g++.dg/reflect/substitute4.C [new file with mode: 0644]