]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: __has_builtin gives the wrong answer [PR106759]
authorMarek Polacek <polacek@redhat.com>
Mon, 29 Aug 2022 20:54:05 +0000 (16:54 -0400)
committerMarek Polacek <polacek@redhat.com>
Tue, 30 Aug 2022 13:05:29 +0000 (09:05 -0400)
commitfe915f35b7d8dc768a2b977c09aa02f933e1d1e9
treed8a5538a61cc4de4e1ac9e3ff6073d55d9d08ada
parent7e3f18439904bf26eabc658caf843b297a052eb4
c++: __has_builtin gives the wrong answer [PR106759]

We've supported __is_nothrow_constructible since r11-4386, but
names_builtin_p didn't know about it, so it gave the wrong answer for
 #if __has_builtin(__is_nothrow_constructible)
 ...
 #endif

I've tested all C++-only built-ins and only two were missing.

PR c++/106759

gcc/cp/ChangeLog:

* cp-objcp-common.cc (names_builtin_p): Handle RID_IS_NOTHROW_ASSIGNABLE
and RID_IS_NOTHROW_CONSTRUCTIBLE.

gcc/testsuite/ChangeLog:

* g++.dg/ext/has-builtin-1.C: New test.
gcc/cp/cp-objcp-common.cc
gcc/testsuite/g++.dg/ext/has-builtin-1.C [new file with mode: 0644]