]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: zero-init and class nttp [PR94568]
authorJason Merrill <jason@redhat.com>
Mon, 5 Aug 2024 19:04:05 +0000 (15:04 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 6 Aug 2024 17:04:13 +0000 (13:04 -0400)
commit352c21c8a22a48d34cbd2fbfe398ee12c0a1d681
tree71b24db8d9d49c3dd683a3d2b538901ef024bd84
parent2f759fa9f4dd78ae8d86482ccda72a335aaac404
c++: zero-init and class nttp [PR94568]

A zero-initializer should not reflect the constness of what it's
initializing, as it does not for initializers with different syntax.

This does have mangling implications for rare C++20 code, but it seems
infeasable to make the mangling depend on -fabi-version while fixing the
semantic bug, and C++20 is still experimental anyway.

PR c++/94568

gcc/cp/ChangeLog:

* init.cc (build_zero_init_1): Call cv_unqualified.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class36.C: Remove xfail.
* g++.dg/cpp2a/nontype-class37.C: Remove xfail.
* g++.dg/cpp1z/nontype-auto26.C: New test.
gcc/cp/init.cc
gcc/testsuite/g++.dg/cpp1z/nontype-auto26.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class36.C
gcc/testsuite/g++.dg/cpp2a/nontype-class37.C