c++ testsuite: Add test for PR107703
authorJakub Jelinek <jakub@redhat.com>
Fri, 10 Mar 2023 19:43:58 +0000 (20:43 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 10 Mar 2023 19:43:58 +0000 (20:43 +0100)
commitc227508d06a63f9b8fede3fd88813accb447060e
tree1522eb0eef0174892a5c576671816981b0f1894c
parent246127ab238bac6aa71a9b4ee1f6fabf776b5ccb
c++ testsuite: Add test for PR107703

This is on top of the
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606398.html
and
https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613724.html
patches (to be precise, the latter isn't essential for it), I've
realized that for the PR107703 bugfix in the first patch I haven't
added some test coverage that the extended floating vs. integral
or vice versa conversions work correctly.

This new testcase adds such checks.  And when writing it I've
found that in ext-floating.h header in the testsuite I forgot back
in November to remove #undef __STDCPP_BFLOAT16_T__ which was left
there because the bfloat16 support wasn't in yet.

The new testcase (and all older ext-floating*.C tests too) passes
on vanilla trunk without the ext-floating.h change (x86_64-linux
-m32/-m64) and with the PR107703 fix also with the ext-floating.h
change.

2023-03-10  Jakub Jelinek  <jakub@redhat.com>

PR target/107703
* g++.dg/cpp23/ext-floating.h (__STDCPP_BFLOAT16_T__): Don't undefine
it.
(std::bfloat16_t): Use decltype (0.0bf16) like libstdc++, rather than
__bf16.
* g++.dg/cpp23/ext-floating14.C: New test.
gcc/testsuite/g++.dg/cpp23/ext-floating.h
gcc/testsuite/g++.dg/cpp23/ext-floating14.C [new file with mode: 0644]