]> gcc.gnu.org Git - gcc.git/commit
c++: Add [dcl.init.aggr] examples to testsuite
authorJakub Jelinek <jakub@redhat.com>
Fri, 19 Jul 2024 06:53:47 +0000 (08:53 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 19 Jul 2024 06:53:47 +0000 (08:53 +0200)
commitcea6473e48b4cfbf16f7b4a804f1562f8da8f25b
tree3be7658d43225a3538f1b32f783f7a7b3266a080
parenta589d3bfe5026ae8ed842bde48b6a5fd74690cf2
c++: Add [dcl.init.aggr] examples to testsuite

When working on the #embed optimization support, I went recently through
all of reshape_init_r* and today I read in detail all the P3106R1 changes
and I believe we implement it that way for years.
To double check that, I've added tests with the current [dcl.init.aggr]
examples but tested in all the languages from C++98 to C++26, of course
guarded as needed for constructs which require newer versions of C++.
The examples come in two tests, one is a runtime test for the non-erroneous
examples, the other is a compile time test for the diagnostics.
The former one includes mostly intact examples with runtime checking (both
to test what is written in the section exactly and to test at least
something with C++98) and then when useful also adds constexpr tests with
static_asserts for C++11 and later.

Tested on x86_64-linux and i686-linux with
GXX_TESTSUITE_STDS=98,11,14,17,20,23,26 make check-g++ RUNTESTFLAGS='dg.exp=aggr-init*.C'

Also tested on GCC 11 branch with
GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ RUNTESTFLAGS='dg.exp=aggr-init*.C'
where just the " is a GCC extension" part of one error is left out,
otherwise it passes the same, ditto with clang 14 (of course with different
diagnostics, but verified it emits diagnostics on the right lines), so I
believe we can claim implementation of this DR paper, either in all versions
or at least in GCC 11+.

2024-07-19  Jakub Jelinek  <jakub@redhat.com>

PR c++/114460
* g++.dg/cpp26/aggr-init1.C: New test.
* g++.dg/cpp26/aggr-init2.C: New test.
gcc/testsuite/g++.dg/cpp26/aggr-init1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp26/aggr-init2.C [new file with mode: 0644]
This page took 0.058202 seconds and 5 git commands to generate.