]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Make __builtin_launder reject invalid types [PR116673]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 11 Sep 2024 10:47:44 +0000 (11:47 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 12 Sep 2024 19:42:48 +0000 (20:42 +0100)
commit9fe57e4879de93b6e3c7b4c226f42d5f3a48474f
tree3c5f6531054e747488806b2b131af161c26806bc
parent2847a541c1f19b67ae84be8d0f6dc8e1f9371d16
c++: Make __builtin_launder reject invalid types [PR116673]

The standard says that std::launder is ill-formed for function pointers
and cv void pointers, so there's no reason for __builtin_launder to
accept them. This change allows implementations of std::launder to defer
to the built-in for error checking, although libstdc++ will continue to
diagnose it directly for more user-friendly diagnostics.

PR c++/116673

gcc/cp/ChangeLog:

* semantics.cc (finish_builtin_launder): Diagnose function
pointers and cv void pointers.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/launder2.C: Adjust dg-error strings.
* g++.dg/cpp1z/launder10.C: New test.
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/cpp1z/launder10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/launder2.C