https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123233
Bug ID: 123233
Summary: control over compile-time specialization
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: uecker at tugraz dot at
Target Milestone: ---
As discussed on the GCC list, it would be useful to provide the programmer
with some explicit control over compile-time specialization.
https://gcc.gnu.org/pipermail/gcc/2025-December/247183.html
This could be in the form of an attribute that specified values or conditions
for which the specialization should be done by generating a dispatcher.
int foo(int n)
[[gnu::specialize(0)]]
{
...
}
or maybe even inside functions
int foo(int n)
{
...
[[gnu::specialize(n == 3)]];
...
}
Potentially, this could be complemented by an annotation that indicates that a
function should be specialized for any compile-time constant passed to a
specific parameter.