This patch series adds some more explanatory diagnostics for traits,
and fixes some issues I found on the way.

The only remaining traits without explanatory diagnostics are either
those where there's no useful explanation to give (e.g. is_const), or
for traits where they are based around flags set during class creation
and so there's no easy predicate to hook into to give diagnostics for
(e.g. is_standard_layout).  I would like to explore a way to give better
diagnostics for the latter kind as well but that's unlikely for GCC16.

All patches successfully bootstrapped and regtested on
x86_64-pc-linux-gnu.

Nathaniel Shead (7):
  c++: Check for error_mark_node in diagnose_trait_expr
  c++: Adjust location of is_*_base_of diagnostics
  c++: Fix diagnostics for __is_destructable
  c++: Add detailed diagnostics for
    __builtin_has_unique_object_representations
  c++: Add detailed diagnostics for __is_layout_compatible
  c++: Add detailed diagnostics for
    __is_pointer_interconvertible_base_of
  c++: Add detailed diagnostics for (and fix) relocation builtins

 gcc/cp/constraint.cc                          |  30 +-
 gcc/cp/cp-tree.h                              |  14 +-
 gcc/cp/method.cc                              |  32 +-
 gcc/cp/semantics.cc                           |  83 ++-
 gcc/cp/tree.cc                                | 565 +++++++++++++-----
 gcc/cp/typeck.cc                              | 146 ++++-
 .../cpp1z/has-unique-obj-representations5.C   |  45 ++
 .../g++.dg/cpp26/trivially-relocatable12.C    |  54 ++
 .../g++.dg/cpp26/trivially-relocatable13.C    | 106 ++++
 .../g++.dg/cpp2a/is-layout-compatible4.C      |  86 +++
 .../is-pointer-interconvertible-base-of2.C    |  29 +
 gcc/testsuite/g++.dg/ext/is_destructible3.C   |   4 +
 .../ext/is_virtual_base_of_diagnostic2.C      |   4 +-
 13 files changed, 955 insertions(+), 243 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp1z/has-unique-obj-representations5.C
 create mode 100644 gcc/testsuite/g++.dg/cpp26/trivially-relocatable12.C
 create mode 100644 gcc/testsuite/g++.dg/cpp26/trivially-relocatable13.C
 create mode 100644 gcc/testsuite/g++.dg/cpp2a/is-layout-compatible4.C
 create mode 100644 
gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-base-of2.C

-- 
2.51.0

Reply via email to