[Bug c++/119688] literal operator template instantiated only once (c++20)

2025-08-06 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119688

--- Comment #4 from Patrick Palka  ---
Btw, a workaround for older GCC is to explicitly zero-initialize all
subobjects. In this particular testcase do ranges::fill(value, 0) in builder's
ctor for example.

[Bug c++/119688] literal operator template instantiated only once (c++20)

2025-08-06 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119688

Patrick Palka  changed:

   What|Removed |Added

   Target Milestone|--- |16.0
 CC||ppalka at gcc dot gnu.org
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Patrick Palka  ---
Fixed for GCC 16

[Bug c++/119688] literal operator template instantiated only once (c++20)

2025-08-06 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119688
Bug 119688 depends on bug 94511, which changed state.

Bug 94511 Summary: User-defined type in non-type template parameter yields an 
incorrect value
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94511

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug c++/119688] literal operator template instantiated only once (c++20)

2025-08-06 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119688

--- Comment #2 from GCC Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:0a7eae02dea519403669ffb1b754f998ce7cf56f

commit r16-3046-g0a7eae02dea519403669ffb1b754f998ce7cf56f
Author: Patrick Palka 
Date:   Wed Aug 6 09:41:01 2025 -0400

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 

[Bug c++/119688] literal operator template instantiated only once (c++20)

2025-04-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119688

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=94511

--- Comment #1 from Andrew Pinski  ---
I suspect this is a dup of bug 94511.