aboutsummaryrefslogtreecommitdiff
path: root/libcpp/include/cpplib.h
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2025-08-06 09:41:01 -0400
committerPatrick Palka <ppalka@redhat.com>2025-08-06 09:41:01 -0400
commit0a7eae02dea519403669ffb1b754f998ce7cf56f (patch)
tree244218ff1f121f35c07264935307552b8c47bec6 /libcpp/include/cpplib.h
parentce7a22bd26c39137658e973797a419d27d767c2c (diff)
downloadgcc-0a7eae02dea519403669ffb1b754f998ce7cf56f.zip
gcc-0a7eae02dea519403669ffb1b754f998ce7cf56f.tar.gz
gcc-0a7eae02dea519403669ffb1b754f998ce7cf56f.tar.bz2
c++: mangling cNTTP object w/ implicit non-trailing zeros [PR121231]
Here the results of A::make(0, 0, 1), (0, 1, 0) and (1, 0, 0) are each represented as a single-element CONSTRUCTOR with CONSTRUCTOR_NO_CLEARING cleared, and when used as as a class NTTP argument we end up mangling them all as A{1}, i.e. eliding both the implicit initial and trailing zeros. Mangling them all the same seems clearly wrong since they're logically different values. It turns out the mangling also omits intermediate zeros, e.g. A::make(1, 0, 1) is mangled as A{1, 1}, the same as A::make(1, 1, 0). It seems we can't omit both trailing and non-trailing implicit zeros without introducing mangling ambiguities. This patch makes us include non-trailing zeros in these manglings (while continuing to omit trailing zeros). This also manifests as a wrong-code bug where the specializations table would conflate different specializations that are in terms of different class NTTP arguments, since the identity of such arguments is tied to their mangling. PR c++/121231 PR c++/119688 PR c++/94511 gcc/ChangeLog: * common.opt: Document additional ABI version 21 change. * doc/invoke.texi: Likewise. gcc/cp/ChangeLog: * mangle.cc (write_expression): Write out implicit non-trailing zeroes of a CONSTRUCTOR when the ABI version is at least 21. gcc/testsuite/ChangeLog: * g++.dg/abi/mangle82.C: New test. * g++.dg/cpp2a/nontype-class73.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libcpp/include/cpplib.h')
0 files changed, 0 insertions, 0 deletions