diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2023-10-11 10:57:06 +1100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-10-19 23:25:31 -0400 |
commit | b69ee50081ca7dbd034cc244cf4515285ca7aa72 (patch) | |
tree | d630d13977ec6384b67c9800b13fc1c38709eef5 /libgcc | |
parent | c85f74813f6a6b73f7f303d0678b3d1c00f8adc2 (diff) | |
download | gcc-b69ee50081ca7dbd034cc244cf4515285ca7aa72.zip gcc-b69ee50081ca7dbd034cc244cf4515285ca7aa72.tar.gz gcc-b69ee50081ca7dbd034cc244cf4515285ca7aa72.tar.bz2 |
c++: Improve diagnostics for constexpr cast from void*
This patch improves the errors given when casting from void* in C++26 to
include the expected type if the types of the pointed-to objects were
not similar. It also ensures (for all standard modes) that void* casts
are checked even for DECL_ARTIFICIAL declarations, such as
lifetime-extended temporaries, and is only ignored for cases where we
know it's OK (e.g. source_location::current) or have no other choice
(heap-allocated data).
gcc/cp/ChangeLog:
* constexpr.cc (is_std_source_location_current): New.
(cxx_eval_constant_expression): Only ignore cast from void* for
specific cases and improve other diagnostics.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-cast4.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Marek Polacek <polacek@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions