On Fri, Sep 05, 2025 at 06:34:23PM +0200, Jason Merrill wrote:
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/pr121801_float16_cst_mangling.C
> > @@ -0,0 +1,12 @@
> > +// PR c++/121801
> > +// { dg-do compile { target c++20 } }
Not all targets have _Float16 support though.
So, I think you want
// { dg-add-options float16 }
and guard the template and uses definitions with either
#ifdef __FLT16_MANT_DIG__
or (if target above is changed to c++23 rather than c++20 with
#ifdef __STDCPP_FLOAT16_T__
> > +
> > +template<_Float16 T> void f() {}
> > +
> > +void uses() {
> > + f<_Float16(1)>();
> > + f<_Float16(2)>();
> > +}
#endif
> > +
> > +// { dg-final { scan-assembler "_Z1fILDF16_3c00EEvv" } }
> > +// { dg-final { scan-assembler "_Z1fILDF16_4000EEvv" } }
And use { target float16 } for these two.
Jakub