aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog293
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-2.c37
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-3.c130
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-4.c6
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2575.C51
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2576.C47
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2577-1.C40
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2577-2.C13
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2577-2.h1
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2577-3.C7
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2577-3.h1
-rw-r--r--gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C2
-rw-r--r--gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C2
-rw-r--r--gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp26/constexpr-new3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp13.C52
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp14.C474
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp15.C474
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp16.C240
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp17.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp18.C109
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp19.C46
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp20.C53
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp21.C103
-rw-r--r--gcc/testsuite/g++.dg/cpp26/feat-cxx26.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/atom-preamble-3.C2
-rw-r--r--gcc/testsuite/g++.dg/modules/class-11_a.H1
-rw-r--r--gcc/testsuite/g++.dg/modules/class-11_b.C1
-rw-r--r--gcc/testsuite/g++.dg/opt/pr82577.C8
-rw-r--r--gcc/testsuite/g++.dg/template/sfinae17.C6
-rw-r--r--gcc/testsuite/g++.dg/torture/noncall-eh-1.C26
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-1.C112
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-10.C23
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-2.C112
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-3.C7
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-4.C112
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-5.C112
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-6.C7
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-7.C112
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-8.C112
-rw-r--r--gcc/testsuite/g++.dg/warn/Wkeyword-macro-9.C22
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr121449.C44
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-1.c62
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-3.c62
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-5.c47
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-6.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-7.c47
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wkeyword-macro-9.c15
-rw-r--r--gcc/testsuite/gcc.dg/asm-hard-reg-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/asm-hard-reg-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/asm-hard-reg-4.c7
-rw-r--r--gcc/testsuite/gcc.dg/asm-hard-reg-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/asm-hard-reg-6.c10
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c9
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c24
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp2
-rw-r--r--gcc/testsuite/gcc.dg/pr118946-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/torture/hardbool-ai.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr121422-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr121422-2.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-107.c29
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr120986-1.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sme/pr121414_1.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11_run.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12.c21
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12_run.c29
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13.c24
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13_run.c15
-rw-r--r--gcc/testsuite/gcc.target/aarch64/torture/pr120986-2.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-18.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-19.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/asm-hard-reg-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90579.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/bitint-1.c83
-rw-r--r--gcc/testsuite/gcc.target/s390/bitint-2.c32
-rw-r--r--gcc/testsuite/gcc.target/s390/bitint-3.c28
-rw-r--r--gcc/testsuite/gcc.target/s390/bitint-4.c71
-rw-r--r--gcc/testsuite/gfortran.dg/generic_stmt_1.f90194
-rw-r--r--gcc/testsuite/gfortran.dg/generic_stmt_2.f9087
-rw-r--r--gcc/testsuite/gfortran.dg/generic_stmt_3.f9096
-rw-r--r--gcc/testsuite/gfortran.dg/generic_stmt_4.f9043
-rw-r--r--gcc/testsuite/lib/multiline.exp3
91 files changed, 4317 insertions, 41 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1ac6084..b3ddaf1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,294 @@
+2025-08-09 H.J. Lu <hjl.tools@gmail.com>
+
+ PR testsuite/121205
+ * gcc.target/i386/asm-hard-reg-2.c (z): Use long long for -m32
+ to trigger RA error.
+
+2025-08-09 Dimitar Dimitrov <dimitar@dinux.eu>
+
+ * g++.dg/modules/class-11_a.H: Skip test for effective
+ default_packed targets.
+ * g++.dg/modules/class-11_b.C: Ditto.
+
+2025-08-09 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/121182
+ * gfortran.dg/generic_stmt_1.f90: New test.
+ * gfortran.dg/generic_stmt_2.f90: New test.
+ * gfortran.dg/generic_stmt_3.f90: New test.
+ * gfortran.dg/generic_stmt_4.f90: New test.
+
+2025-08-09 Dimitar Dimitrov <dimitar@dinux.eu>
+
+ * gcc.dg/torture/hardbool-ai.c: Require target that supports
+ atomic operations on int types.
+
+2025-08-08 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR tree-optimization/120599
+ * g++.dg/torture/noncall-eh-1.C: New test.
+
+2025-08-08 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR tree-optimization/118946
+ PR tree-optimization/121422
+ * gcc.dg/pr118946-1.c: New test.
+ * gcc.dg/torture/pr121422-1.c: New test.
+ * gcc.dg/torture/pr121422-2.c: New test.
+
+2025-08-08 David Malcolm <dmalcolm@redhat.com>
+
+ PR diagnostics/116253
+ * g++.dg/concepts/nested-diagnostics-1-truncated.C: Update for
+ renamed keys to -fdiagnostics-set-output=text
+ * g++.dg/concepts/nested-diagnostics-1.C: Likewise.
+ * g++.dg/concepts/nested-diagnostics-2.C: Likewise.
+ * gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c: New
+ test.
+ * gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c: New test.
+ * gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c:
+ Update for renamed keys to -fdiagnostics-set-output=text.
+ * gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c:
+ Likewise.
+ * gcc.dg/plugin/diagnostic-test-nesting-text-indented.c: Likewise.
+ * gcc.dg/plugin/plugin.exp: Add the new tests.
+
+2025-08-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/120977
+ * gcc.target/arm/cmse/cmse-18.c: Check only the case when FPCXT is
+ not enabled.
+ * gcc.target/arm/cmse/cmse-19.c: New test.
+
+2025-08-08 Pengfei Li <Pengfei.Li2@arm.com>
+
+ PR target/121449
+ * g++.target/aarch64/sve/pr121449.C: New test.
+
+2025-08-08 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/120986
+ * gcc.target/aarch64/torture/pr120986-2.c: New test.
+
+2025-08-08 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/120986
+ * gcc.target/aarch64/pr120986-1.c: New test.
+
+2025-08-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/121389
+ * c-c++-common/asan/pr121389-1.c: New test.
+ * c-c++-common/asan/pr121389-2.c: New test.
+ * c-c++-common/asan/pr121389-3.c: New test.
+ * c-c++-common/asan/pr121389-4.c: New test.
+
+2025-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/117783
+ * g++.dg/cpp26/decomp13.C: New test.
+ * g++.dg/cpp26/decomp14.C: New test.
+ * g++.dg/cpp26/decomp15.C: New test.
+ * g++.dg/cpp26/decomp16.C: New test.
+ * g++.dg/cpp26/decomp17.C: New test.
+ * g++.dg/cpp26/decomp18.C: New test.
+ * g++.dg/cpp26/decomp19.C: New test.
+ * g++.dg/cpp26/decomp20.C: New test.
+ * g++.dg/cpp26/decomp21.C: New test.
+ * g++.dg/cpp26/feat-cxx26.C (__cpp_structured_bindings): Expect
+ 202411 rather than 202403.
+
+2025-08-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/121414
+ * gcc.target/aarch64/sme/pr121414_1.c: New test.
+
+2025-08-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR rtl-optimization/120718
+ * gcc.target/aarch64/sve/acle/general/pr120718.c: New test.
+
+2025-08-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121405
+ * gcc.dg/tree-ssa/ssa-fre-107.c: New testcase.
+ * gcc.target/i386/pr90579.c: Adjust.
+
+2025-08-07 Pengfei Li <Pengfei.Li2@arm.com>
+
+ * gcc.target/aarch64/sve/peel_ind_11.c: New test.
+ * gcc.target/aarch64/sve/peel_ind_11_run.c: New test.
+ * gcc.target/aarch64/sve/peel_ind_12.c: New test.
+ * gcc.target/aarch64/sve/peel_ind_12_run.c: New test.
+ * gcc.target/aarch64/sve/peel_ind_13.c: New test.
+ * gcc.target/aarch64/sve/peel_ind_13_run.c: New test.
+
+2025-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/120778
+ * g++.dg/DRs/dr2577-1.C: New test.
+ * g++.dg/DRs/dr2577-2.C: New test.
+ * g++.dg/DRs/dr2577-2.h: New file.
+ * g++.dg/DRs/dr2577-3.C: New test.
+ * g++.dg/DRs/dr2577-3.h: New file.
+
+2025-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/120778
+ * g++.dg/DRs/dr2575.C: New test.
+
+2025-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/120778
+ * g++.dg/DRs/dr2576.C: New test.
+
+2025-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/120778
+ * gcc.dg/Wkeyword-macro-1.c: New test.
+ * gcc.dg/Wkeyword-macro-2.c: New test.
+ * gcc.dg/Wkeyword-macro-3.c: New test.
+ * gcc.dg/Wkeyword-macro-4.c: New test.
+ * gcc.dg/Wkeyword-macro-5.c: New test.
+ * gcc.dg/Wkeyword-macro-6.c: New test.
+ * gcc.dg/Wkeyword-macro-7.c: New test.
+ * gcc.dg/Wkeyword-macro-8.c: New test.
+ * gcc.dg/Wkeyword-macro-9.c: New test.
+ * g++.dg/warn/Wkeyword-macro-1.C: New test.
+ * g++.dg/warn/Wkeyword-macro-2.C: New test.
+ * g++.dg/warn/Wkeyword-macro-3.C: New test.
+ * g++.dg/warn/Wkeyword-macro-4.C: New test.
+ * g++.dg/warn/Wkeyword-macro-5.C: New test.
+ * g++.dg/warn/Wkeyword-macro-6.C: New test.
+ * g++.dg/warn/Wkeyword-macro-7.C: New test.
+ * g++.dg/warn/Wkeyword-macro-8.C: New test.
+ * g++.dg/warn/Wkeyword-macro-9.C: New test.
+ * g++.dg/warn/Wkeyword-macro-10.C: New test.
+ * g++.dg/opt/pr82577.C: Don't #define register to nothing for
+ C++17 and later. Instead define reg macro to nothing for C++17
+ and later or to register and use it instead of register.
+ * g++.dg/modules/atom-preamble-3.C: Add -Wno-keyword-macro to
+ dg-additional-options.
+ * g++.dg/template/sfinae17.C (static_assert): Rename macro to ...
+ (my_static_assert): ... this.
+ (main): Use my_static_assert instead of static_assert.
+
+2025-08-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
+
+ * gcc.target/s390/bitint-1.c: New test.
+ * gcc.target/s390/bitint-2.c: New test.
+ * gcc.target/s390/bitint-3.c: New test.
+ * gcc.target/s390/bitint-4.c: New test.
+
+2025-08-06 Sam James <sam@gentoo.org>
+
+ * g++.dg/cpp26/constexpr-new3.C: Escape '[' and ']'.
+
+2025-08-06 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.dg/torture/hardbool-ai.c: New.
+ * gcc.dg/torture/hardbool-vi.c: New.
+ * gcc.dg/torture/hardbool.c: Handle NO_BITFIELDS.
+ (add1, preinc, postinc, sub1, predec, postdec): New.
+ (main): Exercise them.
+
+2025-08-06 Martin Uecker <uecker@tugraz.at>
+
+ PR c/108931
+ * gcc.dg/vla-tert-1.c: New test.
+
+2025-08-06 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/121231
+ PR c++/119688
+ PR c++/94511
+ * g++.dg/abi/mangle82.C: New test.
+ * g++.dg/cpp2a/nontype-class73.C: New test.
+
+2025-08-06 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp26/constexpr-new3.C: Tweak diagnostic.
+
+2025-08-06 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/vect-gather-1.c: Adjust to hide N.
+
+2025-08-06 Tejas Belagod <tejas.belagod@arm.com>
+
+ * gcc.target/aarch64/sve/acle/general/cops.c: Fix test.
+
+2025-08-06 Yang Yujie <yangyujie@loongson.cn>
+
+ * gcc.dg/torture/bitint-84.c: New test.
+
+2025-08-06 Yang Yujie <yangyujie@loongson.cn>
+
+ * gcc.dg/torture/bitint-83.c: New test.
+
+2025-08-06 Yang Yujie <yangyujie@loongson.cn>
+
+ * gcc.dg/bitintext.h (BEXTC1): Define. Convert the copied
+ object back to the original type before comparison.
+ (BEXTC): Use BEXTC1 for both the signed and the unsigned case.
+
+2025-08-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/121413
+ * gcc.dg/torture/bitint-85.c: New test.
+
+2025-08-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/121127
+ * gcc.dg/bitint-125.c: New test.
+
+2025-08-06 Yuao Ma <c8ef@outlook.com>
+
+ * gfortran.dg/c_f_pointer_shape_tests_2.f03: Use the new driver.
+ * gfortran.dg/c_f_pointer_shape_tests_4.f03: Ditto.
+ * gfortran.dg/c_f_pointer_shape_tests_4_driver.c: Removed.
+ * gfortran.dg/c_f_pointer_shape_tests_2_driver.c: Renamed to ...
+ * gfortran.dg/c_f_pointer_shape_tests_driver.c: ... this; format
+ with gcc style.
+
+2025-08-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/120778
+ * c-c++-common/cpp/comment-ff-1.c: New test.
+ * c-c++-common/cpp/comment-vtab-1.c: New test.
+
+2025-08-06 Martin Uecker <uecker@tugraz.at>
+
+ PR c/121217
+ * gcc.dg/pr121217.c: New test.
+
+2025-08-06 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/arch-unset-1.c: New test.
+ * gcc.target/riscv/arch-unset-2.c: New test.
+ * gcc.target/riscv/arch-unset-3.c: New test.
+ * gcc.target/riscv/arch-unset-4.c: New test.
+ * gcc.target/riscv/arch-unset-5.c: New test.
+
+2025-08-06 Kwok Cheung Yeung <kcyeung@baylibre.com>
+
+ * c-c++-common/gomp/target-update-iterators-1.c: New.
+ * c-c++-common/gomp/target-update-iterators-2.c: New.
+ * c-c++-common/gomp/target-update-iterators-3.c: New.
+
+2025-08-06 Kwok Cheung Yeung <kcyeung@baylibre.com>
+ Andrew Stubbs <ams@baylibre.com>
+
+ * c-c++-common/gomp/map-6.c (foo): Amend expected error message.
+ * c-c++-common/gomp/target-map-iterators-1.c: New.
+ * c-c++-common/gomp/target-map-iterators-2.c: New.
+ * c-c++-common/gomp/target-map-iterators-3.c: New.
+ * c-c++-common/gomp/target-map-iterators-4.c: New.
+
+2025-08-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/121234
+ * gfortran.dg/pr121234.f90: New test.
+
2025-08-05 Jason Merrill <jason@redhat.com>
PR c++/121068
@@ -2711,7 +3002,7 @@
2025-07-11 Paul Thomas <pault@gcc.gnu.org>
- PR fortran/106135
+ PR fortran/106035
* gfortran.dg/import3.f90: Use -std=f2008 and comment on change
in error message texts with f2018.
* gfortran.dg/import12.f90: New test.
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-1.c b/gcc/testsuite/c-c++-common/asan/pr121389-1.c
new file mode 100644
index 0000000..0116d7a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-1.c
@@ -0,0 +1,23 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address" }
+
+int foo (void);
+int bar (void);
+int baz (unsigned *);
+
+int
+bar (void)
+{
+ do
+ {
+ unsigned t;
+ int u = baz (&t);
+ if (u == 42)
+ [[gnu::musttail]] return foo ();
+ if (u == -42)
+ break;
+ }
+ while (1);
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-2.c b/gcc/testsuite/c-c++-common/asan/pr121389-2.c
new file mode 100644
index 0000000..02914f8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-2.c
@@ -0,0 +1,37 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address" }
+
+int foo (void);
+int bar (void);
+int baz (unsigned *);
+
+int
+bar (void)
+{
+ for (int a = 0; a < 420; ++a)
+ {
+ for (int b = 0; b < 420; ++b)
+ {
+ for (int c = 0; c < 420; ++c)
+ {
+ unsigned t;
+ int u = baz (&t);
+ if (u == 42)
+ [[gnu::musttail]] return foo ();
+ if (u == -42)
+ break;
+ if (u == 16)
+ goto l1;
+ if (u == 18)
+ goto l2;
+ if (u == 20)
+ goto l3;
+ }
+ l3:;
+ }
+ l2:;
+ }
+ l1:;
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-3.c b/gcc/testsuite/c-c++-common/asan/pr121389-3.c
new file mode 100644
index 0000000..5f71e06
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-3.c
@@ -0,0 +1,130 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address" }
+
+int foo (void);
+int bar (void);
+int baz (unsigned *);
+
+int
+bar (void)
+{
+ for (int a = 0; a < 420; ++a)
+ {
+ for (int b = 0; b < 420; ++b)
+ {
+ for (int c = 0; c < 420; ++c)
+ {
+ unsigned t;
+ int u = baz (&t);
+ if (u == 42)
+ [[gnu::musttail]] return foo ();
+ if (u == -42)
+ break;
+ if (u == 16)
+ goto l1;
+ if (u == 18)
+ goto l2;
+ if (u == 20)
+ goto l3;
+ switch (u)
+ {
+ case 100: goto l100;
+ case 101: goto l101;
+ case 102: goto l102;
+ case 103: goto l103;
+ case 104: goto l104;
+ case 105: goto l105;
+ case 106: goto l106;
+ case 107: goto l107;
+ case 108: goto l108;
+ case 109: goto l109;
+ case 110: goto l110;
+ case 111: goto l111;
+ case 112: goto l112;
+ case 113: goto l113;
+ case 114: goto l114;
+ case 115: goto l115;
+ case 116: goto l116;
+ case 117: goto l117;
+ case 118: goto l118;
+ case 119: goto l119;
+ case 120: goto l120;
+ case 121: goto l121;
+ case 122: goto l122;
+ case 123: goto l123;
+ case 124: goto l124;
+ case 125: goto l125;
+ case 126: goto l126;
+ case 127: goto l127;
+ case 128: goto l128;
+ case 129: goto l129;
+ }
+ }
+ l3:;
+ foo ();
+ l100:
+ foo ();
+ l101:
+ foo ();
+ l102:
+ foo ();
+ l103:
+ foo ();
+ l104:
+ foo ();
+ l105:
+ foo ();
+ l106:
+ foo ();
+ l107:
+ foo ();
+ l108:
+ foo ();
+ l109:;
+ }
+ l2:;
+ foo ();
+ l110:
+ foo ();
+ l111:
+ foo ();
+ l112:
+ foo ();
+ l113:
+ foo ();
+ l114:
+ foo ();
+ l115:
+ foo ();
+ l116:
+ foo ();
+ l117:
+ foo ();
+ l118:
+ foo ();
+ l119:;
+ }
+ l1:;
+ foo ();
+ l120:
+ foo ();
+ l121:
+ foo ();
+ l122:
+ foo ();
+ l123:
+ foo ();
+ l124:
+ foo ();
+ l125:
+ foo ();
+ l126:
+ foo ();
+ l127:
+ foo ();
+ l128:
+ foo ();
+ l129:;
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-4.c b/gcc/testsuite/c-c++-common/asan/pr121389-4.c
new file mode 100644
index 0000000..2f7b410
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-4.c
@@ -0,0 +1,6 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address -fdisable-tree-switchlower_O0" }
+// { dg-skip-if "" { *-*-* } { "*" } { "-O0" } }
+
+#include "pr121389-3.c"
diff --git a/gcc/testsuite/g++.dg/DRs/dr2575.C b/gcc/testsuite/g++.dg/DRs/dr2575.C
new file mode 100644
index 0000000..f350282
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2575.C
@@ -0,0 +1,51 @@
+// DR 2575 - Undefined behavior when macro-replacing "defined" operator
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#define A defined
+#if !A(A) // { dg-error "this use of 'defined' may not be portable" }
+#error
+#endif
+#if A(B) // { dg-error "this use of 'defined' may not be portable" }
+#error
+#endif
+#if !A A // { dg-error "this use of 'defined' may not be portable" }
+#error
+#endif
+#if A B // { dg-error "this use of 'defined' may not be portable" }
+#error
+#endif
+#if defined A + B
+#else
+#error
+#endif
+#if defined +B // { dg-error "operator 'defined' requires an identifier" }
+#endif // { dg-error "missing binary operator before token 'B'" "" { target *-*-* } .-1 }
+#if defined 1 // { dg-error "operator 'defined' requires an identifier" }
+#endif
+#if defined // { dg-error "operator 'defined' requires an identifier" }
+#endif
+#if defined (A + B) // { dg-error "missing '\\\)' after 'defined'" }
+#endif // { dg-error "missing binary operator before token 'B'" "" { target *-*-* } .-1 }
+#if defined (+B) // { dg-error "operator 'defined' requires an identifier" }
+#endif // { dg-error "missing binary operator before token 'B'" "" { target *-*-* } .-1 }
+#if defined (1) // { dg-error "operator 'defined' requires an identifier" }
+#endif // { dg-error "missing '\\\(' in expression" "" { target *-*-* } .-1 }
+#if defined () // { dg-error "operator 'defined' requires an identifier" }
+#endif
+#if defined A, B // { dg-error "comma operator in operand of #if" }
+#endif
+#if defined (A), B // { dg-error "comma operator in operand of #if" }
+#endif
+#if (defined A), B // { dg-error "comma operator in operand of #if" }
+#endif
+#if defined (A, B) // { dg-error "missing '\\\)' after 'defined'" }
+#endif // { dg-error "missing binary operator before token 'B'" "" { target *-*-* } .-1 }
+#if defined (A) + B
+#else
+#error
+#endif
+#if (defined A) + B
+#else
+#error
+#endif
diff --git a/gcc/testsuite/g++.dg/DRs/dr2576.C b/gcc/testsuite/g++.dg/DRs/dr2576.C
new file mode 100644
index 0000000..ed53a08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2576.C
@@ -0,0 +1,47 @@
+// DR 2576 - Undefined behavior with macro-expanded #include directives
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#define A <cstddef>
+#include A
+#define B "cstddef"
+#include B
+#define C(x) #x
+#define D(x) C(x)
+#include D(cstddef)
+#include "cstddef" "" // { dg-error "extra tokens at end of '#include' directive" }
+#include "cstddef"".h" // { dg-error "extra tokens at end of '#include' directive" }
+#include // { dg-error "'#include' expects '\"FILENAME\"' or '<FILENAME>'" }
+#include E // { dg-error "'#include' expects '\"FILENAME\"' or '<FILENAME>'" }
+#include <cstddef
+ // { dg-error "missing terminating '>' character" "" { target *-*-* } .-1 }
+#include "cstddef
+ // { dg-error "missing terminating \" character" "" { target *-*-* } .-1 }
+ // { dg-error "'#include' expects '\"FILENAME\"' or '<FILENAME>'" "" { target *-*-* } .-2 }
+#define F cstddef
+#include F // { dg-error "'#include' expects '\"FILENAME\"' or '<FILENAME>'" }
+// There is implementation divergence on the following cases (G H through M N)
+// between e.g. GCC and clang++. clang++ fails on trying to include ' cstddef'
+// and 'cstd def' and 'stddef .h' and 'cstddef ' headers.
+// https://eel.is/c++draft/cpp.include#7.sentence-3 makes the whitespace
+// handling implementation defined and the way GCC handles it can allow
+// certain use cases which aren't otherwise possible. One can still
+// insert spaces into the <> filenames if it is from the same macro.
+#define G <
+#define H cstddef>
+#include G H
+#define I <cstd
+#define J def>
+#include I J
+#define K <stddef
+#define L .h>
+#include K L
+#define M <cstddef
+#define N >
+#include M N
+#define O <cstddef> <cstddef>
+#include O // { dg-error "extra tokens at end of '#include' directive" }
+#define P "cstddef" ""
+#include P // { dg-error "extra tokens at end of '#include' directive" }
+#define Q "cstddef"".h"
+#include Q // { dg-error "extra tokens at end of '#include' directive" }
diff --git a/gcc/testsuite/g++.dg/DRs/dr2577-1.C b/gcc/testsuite/g++.dg/DRs/dr2577-1.C
new file mode 100644
index 0000000..784b6a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2577-1.C
@@ -0,0 +1,40 @@
+// DR 2577 - Undefined behavior for preprocessing directives in macro arguments
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#define A(x)
+#define B(x, y)
+A(
+#if 1 // { dg-error "embedding a directive within macro arguments is not portable" }
+1
+#else // { dg-error "embedding a directive within macro arguments is not portable" }
+2
+#endif // { dg-error "embedding a directive within macro arguments is not portable" }
+)
+B(1,
+#line 234 // { dg-error "embedding a directive within macro arguments is not portable" }
+)
+#line 18
+A(
+#define C 1 // { dg-error "embedding a directive within macro arguments is not portable" }
+)
+A(
+#undef C // { dg-error "embedding a directive within macro arguments is not portable" }
+)
+B(42,
+# 234 "dr2577-1.C" // { dg-error "embedding a directive within macro arguments is not portable" }
+) // { dg-error "style of line directive is a GCC extension" "" { target *-*-* } .-1 }
+#line 28 "dr2577-1.C"
+B(
+#warning "foobar" // { dg-error "embedding a directive within macro arguments is not portable" }
+, 12) // { dg-error "'#warning' before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } .-1 }
+ // { dg-warning "#warning \"foobar\"" "" { target *-*-* } .-2 }
+A(
+#pragma GCC diagnostics push // { dg-error "embedding a directive within macro arguments is not portable" }
+)
+B(5,
+#pragma GCC diagnostics pop // { dg-error "embedding a directive within macro arguments is not portable" }
+)
+A(
+#error foobar // { dg-error "embedding a directive within macro arguments is not portable" }
+) // { dg-error "#error foobar" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/DRs/dr2577-2.C b/gcc/testsuite/g++.dg/DRs/dr2577-2.C
new file mode 100644
index 0000000..e54006a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2577-2.C
@@ -0,0 +1,13 @@
+// DR 2577 - Undefined behavior for preprocessing directives in macro arguments
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#define A(x, y, z) x + y + z
+int a = A(
+#include "dr2577-2.h" // { dg-error "embedding a directive within macro arguments is not portable" }
+,
+#include "dr2577-2.h"
+,
+#include "dr2577-2.h"
+);
+// { dg-error "unterminated argument list invoking macro 'A'" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/DRs/dr2577-2.h b/gcc/testsuite/g++.dg/DRs/dr2577-2.h
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2577-2.h
@@ -0,0 +1 @@
+1
diff --git a/gcc/testsuite/g++.dg/DRs/dr2577-3.C b/gcc/testsuite/g++.dg/DRs/dr2577-3.C
new file mode 100644
index 0000000..6ebf419
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2577-3.C
@@ -0,0 +1,7 @@
+// DR 2577 - Undefined behavior for preprocessing directives in macro arguments
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#define A(x) x
+int a = A(
+#include "dr2577-3.h" // { dg-error "embedding a directive within macro arguments is not portable" }
diff --git a/gcc/testsuite/g++.dg/DRs/dr2577-3.h b/gcc/testsuite/g++.dg/DRs/dr2577-3.h
new file mode 100644
index 0000000..5e36ce0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2577-3.h
@@ -0,0 +1 @@
+1)
diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C
index 0cb1610..5b5e3fe 100644
--- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C
+++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C
@@ -1,6 +1,6 @@
// { dg-do compile { target c++17 } }
// { dg-options "-fconcepts" }
-// { dg-additional-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-locations=no" }
+// { dg-additional-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-locations=no" }
struct dog {};
struct cat {};
diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C
index e642676..a071b55 100644
--- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C
+++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C
@@ -1,6 +1,6 @@
// { dg-do compile { target c++17 } }
// { dg-options "-fconcepts" }
-// { dg-additional-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-locations=no" }
+// { dg-additional-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-locations=no" }
// { dg-additional-options "-fconcepts-diagnostics-depth=3" }
struct dog {};
diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C
index cc15f11..9530bc1 100644
--- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C
+++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C
@@ -1,6 +1,6 @@
// { dg-do compile { target c++17 } }
// { dg-options "-fconcepts" }
-// { dg-additional-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-locations=no" }
+// { dg-additional-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-locations=no" }
struct dog{};
struct cat{};
diff --git a/gcc/testsuite/g++.dg/cpp26/constexpr-new3.C b/gcc/testsuite/g++.dg/cpp26/constexpr-new3.C
index 7466199..c79060f 100644
--- a/gcc/testsuite/g++.dg/cpp26/constexpr-new3.C
+++ b/gcc/testsuite/g++.dg/cpp26/constexpr-new3.C
@@ -37,7 +37,7 @@ baz ()
{
std::allocator<int> a;
auto b = a.allocate (2);
- new (b) long (42); // { dg-error "accessing value of 'int [2]' object through a 'long int' glvalue in a constant expression" }
+ new (b) long (42); // { dg-error "accessing value of 'int \\\[2\\\]' object through a 'long int' glvalue in a constant expression" }
a.deallocate (b, 2);
return true;
}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp13.C b/gcc/testsuite/g++.dg/cpp26/decomp13.C
new file mode 100644
index 0000000..d01590f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp13.C
@@ -0,0 +1,52 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+namespace std {
+ template<typename T> struct tuple_size;
+ template<int, typename> struct tuple_element;
+}
+
+struct S { int a, b, c, d; };
+struct T {
+ int a[5];
+ template <int I> int &get () { return a[I]; }
+};
+
+template<> struct std::tuple_size<T> { static const int value = 5; };
+template<int I> struct std::tuple_element<I,T> { using type = int; };
+
+template <int N>
+void
+foo ()
+{
+ auto [a, ...b, c] = S (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ auto [...d] = S (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ auto [...e, f, ...g, h] = S (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-error "multiple packs in structured binding declaration" "" { target *-*-* } .-2 }
+ auto [i, j, k, l, ...m, n] = S (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-error "6 names provided for structured binding" "" { target *-*-* } .-2 }
+ // { dg-message "while 'S' decomposes into 4 elements" "" { target *-*-* } .-3 }
+ auto [o, ...p, q, r, s] = S (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ auto [t, u, v, w, x, ...y, z] = T (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-error "7 names provided for structured binding" "" { target *-*-* } .-2 }
+ // { dg-message "while 'T' decomposes into 5 elements" "" { target *-*-* } .-3 }
+ int aa[] = { 1, 2, 3 };
+ const auto & [ab, ...ac, ad, ae, af] = aa; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-error "5 names provided for structured binding" "" { target *-*-* } .-2 }
+ // { dg-message "while 'const int \\\[3\\\]' decomposes into 3 elements" "" { target *-*-* } .-3 }
+}
+
+void
+bar ()
+{
+ auto [a, ...b, c, d] = S (); // { dg-error "structured binding pack outside of template" }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp14.C b/gcc/testsuite/g++.dg/cpp26/decomp14.C
new file mode 100644
index 0000000..f626ec9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp14.C
@@ -0,0 +1,474 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do run { target c++11 } }
+// { dg-options "" }
+
+struct S {
+ int a; long long b; short c;
+ explicit operator bool () const noexcept { return true; }
+};
+namespace std {
+ template <typename T> struct tuple_size;
+ template <int, typename> struct tuple_element;
+}
+struct T {
+ short c; int a; long long b;
+ template <int I>
+ typename std::tuple_element<I, T>::type &get ();
+ template <int I>
+ typename std::tuple_element<I, const T>::type &get () const;
+ explicit operator bool () const noexcept { return false; }
+};
+template <>
+struct std::tuple_size<T> { static constexpr int value = 3; };
+template <>
+struct std::tuple_element<0, T> { typedef int type; };
+template <>
+struct std::tuple_element<1, T> { typedef long long type; };
+template <>
+struct std::tuple_element<2, T> { typedef short type; };
+template <>
+std::tuple_element<0, T>::type &T::get <0> () { return a; }
+template <>
+std::tuple_element<1, T>::type &T::get <1> () { return b; }
+template <>
+std::tuple_element<2, T>::type &T::get <2> () { return c; }
+template <>
+struct std::tuple_size<const T> { static constexpr int value = 3; };
+template <>
+struct std::tuple_element<0, const T> { typedef const int type; };
+template <>
+struct std::tuple_element<1, const T> { typedef const long long type; };
+template <>
+struct std::tuple_element<2, const T> { typedef const short type; };
+template <>
+std::tuple_element<0, const T>::type &T::get <0> () const { return a; }
+template <>
+std::tuple_element<1, const T>::type &T::get <1> () const { return b; }
+template <>
+std::tuple_element<2, const T>::type &T::get <2> () const { return c; }
+template <typename T, typename U>
+struct same_type { static const bool value = false; };
+template <typename T>
+struct same_type<T, T> { static const bool value = true; };
+
+int
+sum ()
+{
+ return 0;
+}
+
+template <typename T, typename ...A>
+T
+sum (T x, A... y)
+{
+ return x + sum (y...);
+}
+
+template <typename T>
+T
+square (T x)
+{
+ return x * x;
+}
+
+template <typename T>
+T &
+ref (T &x)
+{
+ return x;
+}
+
+using size_t = decltype (sizeof 0);
+
+template <int N>
+size_t
+foo ()
+{
+ S s = S { 1, 2, 3 };
+ auto [sa, sb, sc] = S { 1, 2, 3 }; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ static_assert (same_type <decltype (sa), int>::value, "");
+ static_assert (same_type <decltype (sb), long long>::value, "");
+ static_assert (same_type <decltype (sc), short>::value, "");
+ auto [sd, ...se] = S { 1, 2, 3 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ constexpr size_t ses = sizeof... (se);
+ static_assert (sizeof... (se) == 2, "");
+ static_assert (same_type <decltype (sd), int>::value, "");
+ static_assert (same_type <decltype (se...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (se...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ const auto & [...sf [[]], sg] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sf) == 2, "");
+ static_assert (same_type <decltype (sf...[0]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sf...[1]), const long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sg), const short>::value, "");
+ auto [sh, si, sj [[]], ...sk] = S { 1, 2, 3 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sk) == 0, "");
+ static_assert (same_type <decltype (sh), int>::value, "");
+ static_assert (same_type <decltype (si), long long>::value, "");
+ static_assert (same_type <decltype (sj), short>::value, "");
+ auto && [sl, ...sm [[maybe_unused]], sn] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sm) == 1, "");
+ static_assert (same_type <decltype (sl), int>::value, "");
+ static_assert (same_type <decltype (sm...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sn), short>::value, "");
+ auto [...so] = S { 1, 2, 3 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (so) == 3, "");
+ static_assert (same_type <decltype (so...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (so...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (so...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...sp, sq, sr, ss [[maybe_unused]]] = S { 1, 2, 3 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sp) == 0, "");
+ static_assert (same_type <decltype (sq), int>::value, "");
+ static_assert (same_type <decltype (sr), long long>::value, "");
+ static_assert (same_type <decltype (ss), short>::value, "");
+ auto [st, ...su, sv, sw] = S { 1, 2, 3 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (su) == 0, "");
+ static_assert (same_type <decltype (st), int>::value, "");
+ static_assert (same_type <decltype (sv), long long>::value, "");
+ static_assert (same_type <decltype (sw), short>::value, "");
+ if (sa != 1 || sb != 2 || sc != 3
+ || sd != 1 || se...[0] != 2 || se...[1] != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sf...[0] != 1 || sf...[1] != 2 || sg != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sh != 1 || si != 2 || sj != 3
+ || sl != 1 || sm...[0] != 2 || sn != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || so...[0] != 1 || so...[1] != 2 || so...[2] != 3// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sq != 1 || sr != 2 || ss != 3
+ || st != 1 || sv != 2 || sw != 3
+ || sum (se...) != 5
+ || sum <decltype (se)...> (se...) != 5
+ || sum (square (square (se))...) != 97
+ || sum (sf...) != 3
+ || sum (sk...) != 0
+ || sum (sm...) != 2
+ || sum (so...) != 6
+ || sum <decltype (so)...> (so...) != 6
+ || sum (square (so)...) != 14
+ || sum (sp...) != 0
+ || sum (su...) != 0
+ || (se + ...) != 5 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + sf) != 3 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + sk) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (sm + ... + 0) != 2 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (so + ...) != 6 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (sp + ... + 0) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + su) != 0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ S s2[] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
+ int i = 0;
+ for (auto [sx, ...sy [[]]] : s2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sy) == 2, "");
+ static_assert (same_type <decltype (sx), int>::value, "");
+ static_assert (same_type <decltype (sy...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sy...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sx != i * 3 + 1 || sum (sy...) != i * 6 + 5)
+ __builtin_abort ();
+ auto fn1 = [&] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn1 ();
+ auto fn2 = [&sy..., &i] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn2 ();
+ auto fn3 = [&...sy2 = sy, &i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn3 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn4 = [&...sy3 = ref (sy), &i] () { if (sum (sy3...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn4 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn5 = [=] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn5 ();
+ auto fn6 = [sy..., i] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn6 ();
+ auto fn7 = [...sy2 = sy, i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn7 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn8 = [...sy3 = square (sy), i] () { if (sum (sy3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn8 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn9 = [&] () { auto fn = [&] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn9 ();
+ auto fn10 = [&sy..., &i] () { auto fn = [&] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn10 ();
+ auto fn11 = [&] () { auto fn = [&...sy2 = sy, &i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn11 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn12 = [&sy..., &i] () { auto fn = [&...sy3 = ref (sy), &i] () { if (sum (sy3...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn12 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn13 = [=] () { auto fn = [=] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn13 ();
+ auto fn14 = [sy..., i] () { auto fn = [=] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn14 ();
+ auto fn15 = [=] () { auto fn = [...sy2 = sy, i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn15 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn16 = [&sy..., &i] () { auto fn = [...sy3 = square (sy), i] () { if (sum (sy3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn16 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ ++i;
+ }
+ i = 0;
+ for (auto [...sz] : s2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (sz) == 3, "");
+ static_assert (same_type <decltype (sz...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sz...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sz...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sum (sz...) != i * 9 + 6)
+ __builtin_abort ();
+ auto fn = [=] () { if (sum (sz...) != i * 9 + 6) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn ();
+ ++i;
+ }
+ if (auto [...sx, sy] = s) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
+ {
+ static_assert (sizeof... (sx) == 2, "");
+ static_assert (same_type <decltype (sx...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sx...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sy), short>::value, "");
+ if (sum (sx...) != 3 || sy != 3)
+ __builtin_abort ();
+ }
+ else
+ __builtin_abort ();
+ T t = T { 3, 1, 2 };
+ auto [ta, tb, tc] = T { 3, 1, 2 }; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ static_assert (same_type <decltype (ta), int>::value, "");
+ static_assert (same_type <decltype (tb), long long>::value, "");
+ static_assert (same_type <decltype (tc), short>::value, "");
+ auto [td [[maybe_unused]], ...te] = T { 3, 1, 2 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (te) == 2, "");
+ static_assert (same_type <decltype (td), int>::value, "");
+ static_assert (same_type <decltype (te...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (te...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...tf [[maybe_unused]], tg] = T { 3, 1, 2 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tf) == 2, "");
+ static_assert (same_type <decltype (tf...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tf...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tg), short>::value, "");
+ const auto & [th, ti, tj, ...tk] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (tk) == 0, "");
+ static_assert (same_type <decltype (th), const int>::value, "");
+ static_assert (same_type <decltype (ti), const long long>::value, "");
+ static_assert (same_type <decltype (tj), const short>::value, "");
+ auto [tl [[]], ...tm [[]], tn [[]]] = T { 3, 1, 2 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tm) == 1, "");
+ static_assert (same_type <decltype (tl), int>::value, "");
+ static_assert (same_type <decltype (tm...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tn), short>::value, "");
+ auto && [...to] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (to) == 3, "");
+ static_assert (same_type <decltype (to...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (to...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (to...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...tp, tq [[]], tr, ts] = T { 3, 1, 2 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tp) == 0, "");
+ static_assert (same_type <decltype (tq), int>::value, "");
+ static_assert (same_type <decltype (tr), long long>::value, "");
+ static_assert (same_type <decltype (ts), short>::value, "");
+ auto [tt, ...tu [[]], tv, tw] = T { 3, 1, 2 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tu) == 0, "");
+ static_assert (same_type <decltype (tt), int>::value, "");
+ static_assert (same_type <decltype (tv), long long>::value, "");
+ static_assert (same_type <decltype (tw), short>::value, "");
+ if (ta != 1 || tb != 2 || tc != 3
+ || td != 1 || te...[0] != 2 || te...[1] != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || tf...[0] != 1 || tf...[1] != 2 || tg != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || th != 1 || ti != 2 || tj != 3
+ || tl != 1 || tm...[0] != 2 || tn != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || to...[0] != 1 || to...[1] != 2 || to...[2] != 3// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || tq != 1 || tr != 2 || ts != 3
+ || tt != 1 || tv != 2 || tw != 3
+ || sum (te...) != 5
+ || sum <decltype (te)...> (te...) != 5
+ || sum (square (square (te))...) != 97
+ || sum (tf...) != 3
+ || sum (tk...) != 0
+ || sum (tm...) != 2
+ || sum (to...) != 6
+ || sum <decltype (to)...> (to...) != 6
+ || sum (square (to)...) != 14
+ || sum (tp...) != 0
+ || sum (tu...) != 0
+ || (te + ...) != 5 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + tf) != 3 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + tk) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (tm + ... + 0) != 2 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (to + ...) != 6 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (tp + ... + 0) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + tu) != 0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ T t2[] = { { 3, 1, 2 }, { 6, 4, 5 }, { 9, 7, 8 } };
+ i = 0;
+ for (auto [tx, ...ty] : t2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ty) == 2, "");
+ static_assert (same_type <decltype (tx), int>::value, "");
+ static_assert (same_type <decltype (ty...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ty...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (tx != i * 3 + 1 || sum (ty...) != i * 6 + 5)
+ __builtin_abort ();
+ auto fn1 = [&] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); };
+ fn1 ();
+ auto fn2 = [&ty..., &i] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn2 ();
+ auto fn3 = [&...ty2 = ty, &i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn3 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn4 = [&...ty3 = ref (ty), &i] () { if (sum (ty3...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn4 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn5 = [=] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); };
+ fn5 ();
+ auto fn6 = [ty..., i] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn6 ();
+ auto fn7 = [...ty2 = ty, i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn7 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn8 = [...ty3 = square (ty), i] () { if (sum (ty3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn8 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn9 = [&] () { auto fn = [&] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); };
+ fn9 ();
+ auto fn10 = [&ty..., &i] () { auto fn = [&] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn10 ();
+ auto fn11 = [&] () { auto fn = [&...ty2 = ty, &i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn11 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn12 = [&ty..., &i] () { auto fn = [&...ty3 = ref (ty), &i] () { if (sum (ty3...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn12 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn13 = [=] () { auto fn = [=] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); };
+ fn13 ();
+ auto fn14 = [ty..., i] () { auto fn = [=] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn14 ();
+ auto fn15 = [=] () { auto fn = [...ty2 = ty, i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn15 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn16 = [&ty..., &i] () { auto fn = [...ty3 = square (ty), i] () { if (sum (ty3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn16 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ ++i;
+ }
+ i = 0;
+ for (auto [...tz] : t2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (tz) == 3, "");
+ static_assert (same_type <decltype (tz...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tz...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tz...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sum (tz...) != i * 9 + 6)
+ __builtin_abort ();
+ auto fn = [=] () { if (sum (tz...) != i * 9 + 6) __builtin_abort (); };
+ fn ();
+ ++i;
+ }
+ if (auto [...tx [[maybe_unused]], ty] = t) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
+ __builtin_abort ();
+ else
+ {
+ static_assert (sizeof... (tx) == 2, "");
+ static_assert (same_type <decltype (tx...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tx...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ty), short>::value, "");
+ if (sum (tx...) != 3 || ty != 3)
+ __builtin_abort ();
+ }
+ int a[3] = { 1, 2, 3 };
+ auto [aa, ab, ac] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ static_assert (same_type <decltype (aa), int>::value, "");
+ static_assert (same_type <decltype (ab), int>::value, "");
+ static_assert (same_type <decltype (ac), int>::value, "");
+ auto [ad [[maybe_unused]], ...ae [[maybe_unused]]] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (ae) == 2, "");
+ static_assert (same_type <decltype (ad), int>::value, "");
+ static_assert (same_type <decltype (ae...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ae...[1]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...af, ag] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (af) == 2, "");
+ static_assert (same_type <decltype (af...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (af...[1]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ag), int>::value, "");
+ auto [ah, ai [[]], aj, ...ak [[]]] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (ak) == 0, "");
+ static_assert (same_type <decltype (ah), int>::value, "");
+ static_assert (same_type <decltype (ai), int>::value, "");
+ static_assert (same_type <decltype (aj), int>::value, "");
+ auto [al, ...am [[]], an] = a;// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (am) == 1, "");
+ static_assert (same_type <decltype (al), int>::value, "");
+ static_assert (same_type <decltype (am...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (an), int>::value, "");
+ const auto &[...ao] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ao) == 3, "");
+ static_assert (same_type <decltype (ao...[0]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ao...[1]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ao...[2]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto &&[...ap, aq, ar [[]], as] = a;// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (ap) == 0, "");
+ static_assert (same_type <decltype (aq), int>::value, "");
+ static_assert (same_type <decltype (ar), int>::value, "");
+ static_assert (same_type <decltype (as), int>::value, "");
+ auto [at, ...au, av, aw] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (au) == 0, "");
+ static_assert (same_type <decltype (at), int>::value, "");
+ static_assert (same_type <decltype (av), int>::value, "");
+ static_assert (same_type <decltype (aw), int>::value, "");
+ if (aa != 1 || ab != 2 || ac != 3
+ || ad != 1 || ae...[0] != 2 || ae...[1] != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || af...[0] != 1 || af...[1] != 2 || ag != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || ah != 1 || ai != 2 || aj != 3
+ || al != 1 || am...[0] != 2 || an != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || ao...[0] != 1 || ao...[1] != 2 || ao...[2] != 3// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || aq != 1 || ar != 2 || as != 3
+ || at != 1 || av != 2 || aw != 3
+ || sum (ae...) != 5
+ || sum <decltype (ae)...> (ae...) != 5
+ || sum (square (square (ae))...) != 97
+ || sum (af...) != 3
+ || sum (ak...) != 0
+ || sum (am...) != 2
+ || sum (ao...) != 6
+ || sum <decltype (ao)...> (ao...) != 6
+ || sum (square (ao)...) != 14
+ || sum (ap...) != 0
+ || sum (au...) != 0
+ || (ae + ...) != 5 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + af) != 3 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + ak) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (am + ... + 0) != 2 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (ao + ...) != 6 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (ap + ... + 0) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + au) != 0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ return ses;
+}
+
+int
+main ()
+{
+ if (foo <0> () != 2)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp15.C b/gcc/testsuite/g++.dg/cpp26/decomp15.C
new file mode 100644
index 0000000..9bb55b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp15.C
@@ -0,0 +1,474 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do run { target c++11 } }
+// { dg-options "" }
+
+struct S {
+ int a; long long b; short c;
+ explicit operator bool () const noexcept { return true; }
+};
+namespace std {
+ template <typename T> struct tuple_size;
+ template <int, typename> struct tuple_element;
+}
+struct T {
+ short c; int a; long long b;
+ template <int I>
+ typename std::tuple_element<I, T>::type &get ();
+ template <int I>
+ typename std::tuple_element<I, const T>::type &get () const;
+ explicit operator bool () const noexcept { return false; }
+};
+template <>
+struct std::tuple_size<T> { static constexpr int value = 3; };
+template <>
+struct std::tuple_element<0, T> { typedef int type; };
+template <>
+struct std::tuple_element<1, T> { typedef long long type; };
+template <>
+struct std::tuple_element<2, T> { typedef short type; };
+template <>
+std::tuple_element<0, T>::type &T::get <0> () { return a; }
+template <>
+std::tuple_element<1, T>::type &T::get <1> () { return b; }
+template <>
+std::tuple_element<2, T>::type &T::get <2> () { return c; }
+template <>
+struct std::tuple_size<const T> { static constexpr int value = 3; };
+template <>
+struct std::tuple_element<0, const T> { typedef const int type; };
+template <>
+struct std::tuple_element<1, const T> { typedef const long long type; };
+template <>
+struct std::tuple_element<2, const T> { typedef const short type; };
+template <>
+std::tuple_element<0, const T>::type &T::get <0> () const { return a; }
+template <>
+std::tuple_element<1, const T>::type &T::get <1> () const { return b; }
+template <>
+std::tuple_element<2, const T>::type &T::get <2> () const { return c; }
+template <typename T, typename U>
+struct same_type { static const bool value = false; };
+template <typename T>
+struct same_type<T, T> { static const bool value = true; };
+
+int
+sum ()
+{
+ return 0;
+}
+
+template <typename T, typename ...A>
+T
+sum (T x, A... y)
+{
+ return x + sum (y...);
+}
+
+template <typename T>
+T
+square (T x)
+{
+ return x * x;
+}
+
+template <typename T>
+T &
+ref (T &x)
+{
+ return x;
+}
+
+using size_t = decltype (sizeof 0);
+
+template <typename S, typename T, typename U>
+size_t
+foo ()
+{
+ S s = S { 1, 2, 3 };
+ auto [sa, sb, sc] = S { 1, 2, 3 }; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ static_assert (same_type <decltype (sa), int>::value, "");
+ static_assert (same_type <decltype (sb), long long>::value, "");
+ static_assert (same_type <decltype (sc), short>::value, "");
+ auto [sd, ...se] = S { 1, 2, 3 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (se) == 2, "");
+ static_assert (same_type <decltype (sd), int>::value, "");
+ static_assert (same_type <decltype (se...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (se...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ const auto & [...sf [[]], sg] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sf) == 2, "");
+ static_assert (same_type <decltype (sf...[0]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sf...[1]), const long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sg), const short>::value, "");
+ auto [sh, si, sj [[]], ...sk] = S { 1, 2, 3 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sk) == 0, "");
+ static_assert (same_type <decltype (sh), int>::value, "");
+ static_assert (same_type <decltype (si), long long>::value, "");
+ static_assert (same_type <decltype (sj), short>::value, "");
+ auto && [sl, ...sm [[maybe_unused]], sn] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sm) == 1, "");
+ static_assert (same_type <decltype (sl), int>::value, "");
+ static_assert (same_type <decltype (sm...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sn), short>::value, "");
+ auto [...so] = S { 1, 2, 3 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (so) == 3, "");
+ static_assert (same_type <decltype (so...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (so...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (so...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...sp, sq, sr, ss [[maybe_unused]]] = S { 1, 2, 3 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sp) == 0, "");
+ static_assert (same_type <decltype (sq), int>::value, "");
+ static_assert (same_type <decltype (sr), long long>::value, "");
+ static_assert (same_type <decltype (ss), short>::value, "");
+ auto [st, ...su, sv, sw] = S { 1, 2, 3 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (su) == 0, "");
+ static_assert (same_type <decltype (st), int>::value, "");
+ static_assert (same_type <decltype (sv), long long>::value, "");
+ static_assert (same_type <decltype (sw), short>::value, "");
+ if (sa != 1 || sb != 2 || sc != 3
+ || sd != 1 || se...[0] != 2 || se...[1] != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sf...[0] != 1 || sf...[1] != 2 || sg != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sh != 1 || si != 2 || sj != 3
+ || sl != 1 || sm...[0] != 2 || sn != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || so...[0] != 1 || so...[1] != 2 || so...[2] != 3// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sq != 1 || sr != 2 || ss != 3
+ || st != 1 || sv != 2 || sw != 3
+ || sum (se...) != 5
+ || sum <decltype (se)...> (se...) != 5
+ || sum (square (square (se))...) != 97
+ || sum (sf...) != 3
+ || sum (sk...) != 0
+ || sum (sm...) != 2
+ || sum (so...) != 6
+ || sum <decltype (so)...> (so...) != 6
+ || sum (square (so)...) != 14
+ || sum (sp...) != 0
+ || sum (su...) != 0
+ || (se + ...) != 5 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + sf) != 3 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + sk) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (sm + ... + 0) != 2 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (so + ...) != 6 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (sp + ... + 0) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + su) != 0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ S s2[] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
+ int i = 0;
+ for (auto [sx, ...sy [[]]] : s2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (sy) == 2, "");
+ static_assert (same_type <decltype (sx), int>::value, "");
+ static_assert (same_type <decltype (sy...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sy...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sx != i * 3 + 1 || sum (sy...) != i * 6 + 5)
+ __builtin_abort ();
+ auto fn1 = [&] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn1 ();
+ auto fn2 = [&sy..., &i] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn2 ();
+ auto fn3 = [&...sy2 = sy, &i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn3 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn4 = [&...sy3 = ref (sy), &i] () { if (sum (sy3...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn4 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn5 = [=] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn5 ();
+ auto fn6 = [sy..., i] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn6 ();
+ auto fn7 = [...sy2 = sy, i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn7 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn8 = [...sy3 = square (sy), i] () { if (sum (sy3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn8 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn9 = [&] () { auto fn = [&] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn9 ();
+ auto fn10 = [&sy..., &i] () { auto fn = [&] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn10 ();
+ auto fn11 = [&] () { auto fn = [&...sy2 = sy, &i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn11 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn12 = [&sy..., &i] () { auto fn = [&...sy3 = ref (sy), &i] () { if (sum (sy3...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn12 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn13 = [=] () { auto fn = [=] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn13 ();
+ auto fn14 = [sy..., i] () { auto fn = [=] () { if (sum (sy...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn14 ();
+ auto fn15 = [=] () { auto fn = [...sy2 = sy, i] () { if (sum (sy2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn15 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn16 = [&sy..., &i] () { auto fn = [...sy3 = square (sy), i] () { if (sum (sy3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn16 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ ++i;
+ }
+ i = 0;
+ for (auto [...sz] : s2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (sz) == 3, "");
+ static_assert (same_type <decltype (sz...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sz...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sz...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sum (sz...) != i * 9 + 6)
+ __builtin_abort ();
+ auto fn = [=] () { if (sum (sz...) != i * 9 + 6) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn ();
+ ++i;
+ }
+ if (auto [...sx, sy] = s) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
+ {
+ static_assert (sizeof... (sx) == 2, "");
+ static_assert (same_type <decltype (sx...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sx...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (sy), short>::value, "");
+ if (sum (sx...) != 3 || sy != 3)
+ __builtin_abort ();
+ }
+ else
+ __builtin_abort ();
+ T t = T { 3, 1, 2 };
+ auto [ta, tb, tc] = T { 3, 1, 2 }; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ static_assert (same_type <decltype (ta), int>::value, "");
+ static_assert (same_type <decltype (tb), long long>::value, "");
+ static_assert (same_type <decltype (tc), short>::value, "");
+ auto [td [[maybe_unused]], ...te] = T { 3, 1, 2 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (te) == 2, "");
+ static_assert (same_type <decltype (td), int>::value, "");
+ static_assert (same_type <decltype (te...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (te...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...tf [[maybe_unused]], tg] = T { 3, 1, 2 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tf) == 2, "");
+ static_assert (same_type <decltype (tf...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tf...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tg), short>::value, "");
+ const auto & [th, ti, tj, ...tk] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (tk) == 0, "");
+ static_assert (same_type <decltype (th), const int>::value, "");
+ static_assert (same_type <decltype (ti), const long long>::value, "");
+ static_assert (same_type <decltype (tj), const short>::value, "");
+ auto [tl [[]], ...tm [[]], tn [[]]] = T { 3, 1, 2 }; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tm) == 1, "");
+ static_assert (same_type <decltype (tl), int>::value, "");
+ static_assert (same_type <decltype (tm...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tn), short>::value, "");
+ auto && [...to] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (to) == 3, "");
+ constexpr size_t tos = sizeof... (to);
+ static_assert (same_type <decltype (to...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (to...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (to...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...tp, tq [[]], tr, ts] = T { 3, 1, 2 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tp) == 0, "");
+ static_assert (same_type <decltype (tq), int>::value, "");
+ static_assert (same_type <decltype (tr), long long>::value, "");
+ static_assert (same_type <decltype (ts), short>::value, "");
+ auto [tt, ...tu [[]], tv, tw] = T { 3, 1, 2 };// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (tu) == 0, "");
+ static_assert (same_type <decltype (tt), int>::value, "");
+ static_assert (same_type <decltype (tv), long long>::value, "");
+ static_assert (same_type <decltype (tw), short>::value, "");
+ if (ta != 1 || tb != 2 || tc != 3
+ || td != 1 || te...[0] != 2 || te...[1] != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || tf...[0] != 1 || tf...[1] != 2 || tg != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || th != 1 || ti != 2 || tj != 3
+ || tl != 1 || tm...[0] != 2 || tn != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || to...[0] != 1 || to...[1] != 2 || to...[2] != 3// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || tq != 1 || tr != 2 || ts != 3
+ || tt != 1 || tv != 2 || tw != 3
+ || sum (te...) != 5
+ || sum <decltype (te)...> (te...) != 5
+ || sum (square (square (te))...) != 97
+ || sum (tf...) != 3
+ || sum (tk...) != 0
+ || sum (tm...) != 2
+ || sum (to...) != 6
+ || sum <decltype (to)...> (to...) != 6
+ || sum (square (to)...) != 14
+ || sum (tp...) != 0
+ || sum (tu...) != 0
+ || (te + ...) != 5 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + tf) != 3 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + tk) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (tm + ... + 0) != 2 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (to + ...) != 6 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (tp + ... + 0) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + tu) != 0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ T t2[] = { { 3, 1, 2 }, { 6, 4, 5 }, { 9, 7, 8 } };
+ i = 0;
+ for (auto [tx, ...ty] : t2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ty) == 2, "");
+ static_assert (same_type <decltype (tx), int>::value, "");
+ static_assert (same_type <decltype (ty...[0]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ty...[1]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (tx != i * 3 + 1 || sum (ty...) != i * 6 + 5)
+ __builtin_abort ();
+ auto fn1 = [&] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); };
+ fn1 ();
+ auto fn2 = [&ty..., &i] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn2 ();
+ auto fn3 = [&...ty2 = ty, &i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn3 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn4 = [&...ty3 = ref (ty), &i] () { if (sum (ty3...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn4 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn5 = [=] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); };
+ fn5 ();
+ auto fn6 = [ty..., i] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn6 ();
+ auto fn7 = [...ty2 = ty, i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn7 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn8 = [...ty3 = square (ty), i] () { if (sum (ty3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn8 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn9 = [&] () { auto fn = [&] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); };
+ fn9 ();
+ auto fn10 = [&ty..., &i] () { auto fn = [&] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn10 ();
+ auto fn11 = [&] () { auto fn = [&...ty2 = ty, &i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn11 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn12 = [&ty..., &i] () { auto fn = [&...ty3 = ref (ty), &i] () { if (sum (ty3...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn12 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ auto fn13 = [=] () { auto fn = [=] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); };
+ fn13 ();
+ auto fn14 = [ty..., i] () { auto fn = [=] () { if (sum (ty...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "captured structured bindings are" "" { target c++17_down } }
+ fn14 ();
+ auto fn15 = [=] () { auto fn = [...ty2 = ty, i] () { if (sum (ty2...) != i * 6 + 5) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn15 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ auto fn16 = [&ty..., &i] () { auto fn = [...ty3 = square (ty), i] () { if (sum (ty3...) != (i * 3 + 2) * (i * 3 + 2) + (i * 3 + 3) * (i * 3 + 3)) __builtin_abort (); }; fn (); }; // { dg-warning "pack init-capture only available with" "" { target c++17_down } }
+ fn16 (); // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 }
+ // { dg-warning "captured structured bindings are" "" { target c++17_down } .-2 }
+ ++i;
+ }
+ i = 0;
+ for (auto [...tz] : t2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (tz) == 3, "");
+ static_assert (same_type <decltype (tz...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tz...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tz...[2]), short>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sum (tz...) != i * 9 + 6)
+ __builtin_abort ();
+ auto fn = [=] () { if (sum (tz...) != i * 9 + 6) __builtin_abort (); };
+ fn ();
+ ++i;
+ }
+ if (auto [...tx [[maybe_unused]], ty] = t) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
+ __builtin_abort ();
+ else
+ {
+ static_assert (sizeof... (tx) == 2, "");
+ static_assert (same_type <decltype (tx...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (tx...[1]), long long>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ty), short>::value, "");
+ if (sum (tx...) != 3 || ty != 3)
+ __builtin_abort ();
+ }
+ U a[3] = { 1, 2, 3 };
+ auto [aa, ab, ac] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ static_assert (same_type <decltype (aa), int>::value, "");
+ static_assert (same_type <decltype (ab), int>::value, "");
+ static_assert (same_type <decltype (ac), int>::value, "");
+ auto [ad [[maybe_unused]], ...ae [[maybe_unused]]] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (ae) == 2, "");
+ static_assert (same_type <decltype (ad), int>::value, "");
+ static_assert (same_type <decltype (ae...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ae...[1]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...af, ag] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (af) == 2, "");
+ static_assert (same_type <decltype (af...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (af...[1]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ag), int>::value, "");
+ auto [ah, ai [[]], aj, ...ak [[]]] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (ak) == 0, "");
+ static_assert (same_type <decltype (ah), int>::value, "");
+ static_assert (same_type <decltype (ai), int>::value, "");
+ static_assert (same_type <decltype (aj), int>::value, "");
+ auto [al, ...am [[]], an] = a;// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (am) == 1, "");
+ static_assert (same_type <decltype (al), int>::value, "");
+ static_assert (same_type <decltype (am...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (an), int>::value, "");
+ const auto &[...ao] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ao) == 3, "");
+ static_assert (same_type <decltype (ao...[0]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ao...[1]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ao...[2]), const int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto &&[...ap, aq, ar [[]], as] = a;// { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } .-2 }
+ static_assert (sizeof... (ap) == 0, "");
+ static_assert (same_type <decltype (aq), int>::value, "");
+ static_assert (same_type <decltype (ar), int>::value, "");
+ static_assert (same_type <decltype (as), int>::value, "");
+ auto [at, ...au, av, aw] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (au) == 0, "");
+ static_assert (same_type <decltype (at), int>::value, "");
+ static_assert (same_type <decltype (av), int>::value, "");
+ static_assert (same_type <decltype (aw), int>::value, "");
+ if (aa != 1 || ab != 2 || ac != 3
+ || ad != 1 || ae...[0] != 2 || ae...[1] != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || af...[0] != 1 || af...[1] != 2 || ag != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || ah != 1 || ai != 2 || aj != 3
+ || al != 1 || am...[0] != 2 || an != 3 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || ao...[0] != 1 || ao...[1] != 2 || ao...[2] != 3// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || aq != 1 || ar != 2 || as != 3
+ || at != 1 || av != 2 || aw != 3
+ || sum (ae...) != 5
+ || sum <decltype (ae)...> (ae...) != 5
+ || sum (square (square (ae))...) != 97
+ || sum (af...) != 3
+ || sum (ak...) != 0
+ || sum (am...) != 2
+ || sum (ao...) != 6
+ || sum <decltype (ao)...> (ao...) != 6
+ || sum (square (ao)...) != 14
+ || sum (ap...) != 0
+ || sum (au...) != 0
+ || (ae + ...) != 5 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + af) != 3 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + ak) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (am + ... + 0) != 2 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (ao + ...) != 6 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (ap + ... + 0) != 0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + au) != 0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ return tos;
+}
+
+int
+main ()
+{
+ if (foo <S, T, int> () != 3)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp16.C b/gcc/testsuite/g++.dg/cpp26/decomp16.C
new file mode 100644
index 0000000..548f9af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp16.C
@@ -0,0 +1,240 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do run { target c++11 } }
+// { dg-options "" }
+
+int
+sum ()
+{
+ return 0;
+}
+
+template <typename T, typename ...A>
+T
+sum (T x, A... y)
+{
+ return x + sum (y...);
+}
+
+template <typename T>
+T
+square (T x)
+{
+ return x * x;
+}
+
+template <typename T, typename U>
+struct same_type { static const bool value = false; };
+
+template <typename T>
+struct same_type<T, T> { static const bool value = true; };
+
+typedef int V __attribute__((vector_size (16 * sizeof (int))));
+
+template <int N>
+void
+foo ()
+{
+ V v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ auto [...va] = v; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (va) == 16, "");
+ static_assert (same_type <decltype (va...[5]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (va...[13]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [vb, ...vc, vd, ve] = v; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (vc) == 13, "");
+ static_assert (same_type <decltype (vb), int>::value, "");
+ static_assert (same_type <decltype (vc...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vc...[12]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vd), int>::value, "");
+ static_assert (same_type <decltype (ve), int>::value, "");
+ auto [vf, vg, vh, vi, ...vj] = v; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (vj) == 12, "");
+ static_assert (same_type <decltype (vf), int>::value, "");
+ static_assert (same_type <decltype (vg), int>::value, "");
+ static_assert (same_type <decltype (vh), int>::value, "");
+ static_assert (same_type <decltype (vi), int>::value, "");
+ static_assert (same_type <decltype (vj...[2]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vj...[10]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (va...[13] != 14 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (va...) != 8 * 17
+ || sum (square (va)...) != 1496
+ || vb != 1
+ || vc...[10] != 12 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (vc...) != 15 * 7 - 1
+ || sum <decltype (vc)...> (vc...) != 15 * 7 - 1
+ || vd != 15 || ve != 16
+ || vf != 1 || vg != 2 || vh != 3 || vi != 4
+ || sum (vj...) != 8 * 17 - 10
+ || (va + ...) != 8 * 17 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + vc) != 15 * 7 - 1 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + vj) != 8 * 17 - 10) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ V v2[3] = { v, v + 1, v + 2 };
+ int i = 0;
+ for (auto [vk, ...vl, vm] : v2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (vl) == 14, "");
+ static_assert (same_type <decltype (vk), int>::value, "");
+ static_assert (same_type <decltype (vl...[1]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vl...[9]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vm), int>::value, "");
+ if (vk != i + 1 || sum (vl...) != i * 14 + 15 * 8 - 1 || vm != i + 16)
+ __builtin_abort ();
+ ++i;
+ }
+ _Complex double c = 1.0 + 2.0i;
+ auto [...ca] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ca) == 2, "");
+ static_assert (same_type <decltype (ca...[0]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ca...[1]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [cb, ...cc, cd] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (cc) == 0, "");
+ static_assert (same_type <decltype (cb), double>::value, "");
+ static_assert (same_type <decltype (cd), double>::value, "");
+ auto [ce, ...cf] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (cf) == 1, "");
+ static_assert (same_type <decltype (ce), double>::value, "");
+ static_assert (same_type <decltype (cf...[0]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...cg, ch] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (cg) == 1, "");
+ static_assert (same_type <decltype (cg...[0]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ch), double>::value, "");
+ if (ca...[0] != 1.0 || ca...[1] != 2.0// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (ca...) != 3.0
+ || sum <decltype (ca)...> (ca...) != 3.0
+ || sum (square (square (square (ca)))...) != 257.0
+ || cb != 1.0 || cd != 2.0
+ || ce != 1.0 || cf...[0] != 2.0 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (cf...) != 2.0
+ || cg...[0] != 1.0 || ch != 2.0 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (cg...) != 1.0
+ || (ca + ...) != 3.0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0.0 + ... + cc) != 0.0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + cf) != 2.0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (cg + ... + 0.0) != 1.0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ _Complex float c2[3] = { 1.0f + 2.0fi, 2.0f + 3.0fi, 3.0f + 4.0fi };
+ i = 0;
+ for (auto [...ci] : c2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ci) == 2, "");
+ static_assert (same_type <decltype (ci...[0]), float>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ci...[1]), float>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sum (ci...) != i * 2 + 3.0f)
+ __builtin_abort ();
+ ++i;
+ }
+}
+
+template <typename V, typename C, typename D>
+void
+bar ()
+{
+ V v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ auto [...va] = v; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (va) == 16, "");
+ static_assert (same_type <decltype (va...[5]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (va...[13]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [vb, ...vc, vd, ve] = v; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (vc) == 13, "");
+ static_assert (same_type <decltype (vb), int>::value, "");
+ static_assert (same_type <decltype (vc...[0]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vc...[12]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vd), int>::value, "");
+ static_assert (same_type <decltype (ve), int>::value, "");
+ auto [vf, vg, vh, vi, ...vj] = v; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (vj) == 12, "");
+ static_assert (same_type <decltype (vf), int>::value, "");
+ static_assert (same_type <decltype (vg), int>::value, "");
+ static_assert (same_type <decltype (vh), int>::value, "");
+ static_assert (same_type <decltype (vi), int>::value, "");
+ static_assert (same_type <decltype (vj...[2]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vj...[10]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (va...[13] != 14 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (va...) != 8 * 17
+ || vb != 1
+ || vc...[10] != 12 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (vc...) != 15 * 7 - 1
+ || sum <decltype (vc)...> (vc...) != 15 * 7 - 1
+ || vd != 15 || ve != 16
+ || vf != 1 || vg != 2 || vh != 3 || vi != 4
+ || sum (vj...) != 8 * 17 - 10
+ || (va + ...) != 8 * 17 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + vc) != 15 * 7 - 1 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0 + ... + vj) != 8 * 17 - 10) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ V v2[3] = { v, v + 1, v + 2 };
+ int i = 0;
+ for (auto [vk, ...vl, vm] : v2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (vl) == 14, "");
+ static_assert (same_type <decltype (vk), int>::value, "");
+ static_assert (same_type <decltype (vl...[1]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vl...[9]), int>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (vm), int>::value, "");
+ if (vk != i + 1 || sum (vl...) != i * 14 + 15 * 8 - 1 || vm != i + 16)
+ __builtin_abort ();
+ ++i;
+ }
+ C c = 1.0 + 2.0i;
+ auto [...ca] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ca) == 2, "");
+ static_assert (same_type <decltype (ca...[0]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ca...[1]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [cb, ...cc, cd] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (cc) == 0, "");
+ static_assert (same_type <decltype (cb), double>::value, "");
+ static_assert (same_type <decltype (cd), double>::value, "");
+ auto [ce, ...cf] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (cf) == 1, "");
+ static_assert (same_type <decltype (ce), double>::value, "");
+ static_assert (same_type <decltype (cf...[0]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ auto [...cg, ch] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (cg) == 1, "");
+ static_assert (same_type <decltype (cg...[0]), double>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ch), double>::value, "");
+ if (ca...[0] != 1.0 || ca...[1] != 2.0// { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (ca...) != 3.0
+ || sum <decltype (ca)...> (ca...) != 3.0
+ || cb != 1.0 || cd != 2.0
+ || ce != 1.0 || cf...[0] != 2.0 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (cf...) != 2.0
+ || cg...[0] != 1.0 || ch != 2.0 // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ || sum (cg...) != 1.0
+ || (ca + ...) != 3.0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (0.0 + ... + cc) != 0.0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (... + cf) != 2.0 // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ || (cg + ... + 0.0) != 1.0) // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+ __builtin_abort ();
+ D c2[3] = { 1.0f + 2.0fi, 2.0f + 3.0fi, 3.0f + 4.0fi };
+ i = 0;
+ for (auto [...ci] : c2) // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ci) == 2, "");
+ static_assert (same_type <decltype (ci...[0]), float>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ static_assert (same_type <decltype (ci...[1]), float>::value, ""); // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ if (sum (ci...) != i * 2 + 3.0f)
+ __builtin_abort ();
+ ++i;
+ }
+}
+
+int
+main ()
+{
+ foo <0> ();
+ bar <V, _Complex double, _Complex float> ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp17.C b/gcc/testsuite/g++.dg/cpp26/decomp17.C
new file mode 100644
index 0000000..49ad0e2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp17.C
@@ -0,0 +1,28 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+typedef int V __attribute__((vector_size (16 * sizeof (int))));
+
+template <int N>
+void
+foo ()
+{
+ V v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ auto [va, vb, vc, vd, ...ve, vf, vg, vh, vi, vj, vk, vl, vm, vn, vo, vp, vq, vr] = v;
+ // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } .-1 }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-2 }
+ // { dg-error "18 names provided for structured binding" "" { target *-*-* } .-3 }
+ // { dg-message "while '__vector\\\(16\\\) int' decomposes into 16 elements" "" { target *-*-* } .-4 }
+ _Complex double c = 1.0 + 2.0i;
+ auto [...ca, cb, cc, cd] = c; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-error "4 names provided for structured binding" "" { target *-*-* } .-2 }
+ // { dg-message "while '__complex__ double' decomposes into 2 elements" "" { target *-*-* } .-3 }
+}
+
+int
+main ()
+{
+ foo <0> ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp18.C b/gcc/testsuite/g++.dg/cpp26/decomp18.C
new file mode 100644
index 0000000..86b9bf4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp18.C
@@ -0,0 +1,109 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do run { target c++11 } }
+// { dg-options "" }
+
+struct S { int a, b, c; };
+namespace std {
+ template <typename T> struct tuple_size;
+ template <int, typename> struct tuple_element;
+}
+struct T {
+ int a[3];
+ template <int I>
+ int &get () { return a[2 - I]; }
+};
+template <>
+struct std::tuple_size<T> { static constexpr int value = 3; };
+template <int N>
+struct std::tuple_element<N, T> { typedef int type; };
+
+template <int N>
+inline int
+foo ()
+{
+ static int a[4] = { N, N + 1, N + 2, N + 3 };
+ static auto [...aa] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'static' only in" "" { target c++17_down } .-2 }
+ aa...[1]++; // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ return (... + aa); // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+}
+
+template <int N>
+inline int
+bar ()
+{
+ static S s = { N, N + 1, N + 2 };
+ static auto [...sa] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'static' only in" "" { target c++17_down } .-2 }
+ sa...[1]++; // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ return (sa + ...); // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+}
+
+template <int N>
+inline int
+baz ()
+{
+ static T t = { { N, N + 1, N + 2 } };
+ static auto [ta, ...tb, tc, td] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'static' only in" "" { target c++17_down } .-2 }
+ tc++;
+ return ((ta + tc + td) + ... + tb); // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+}
+
+template <int N>
+inline int
+qux ()
+{
+ thread_local int a[4] = { N, N + 1, N + 2, N + 3 };
+ thread_local auto [...aa] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'thread_local' only in" "" { target c++17_down } .-2 }
+ aa...[1]++; // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ return (... + aa); // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+}
+
+template <int N>
+inline int
+freddy ()
+{
+ thread_local S s = { N, N + 1, N + 2 };
+ thread_local auto [...sa] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'thread_local' only in" "" { target c++17_down } .-2 }
+ sa...[1]++; // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ return (sa + ...); // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+}
+
+template <int N>
+inline int
+corge ()
+{
+ thread_local T t = { { N, N + 1, N + 2 } };
+ thread_local auto [ta, ...tb, tc, td] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'thread_local' only in" "" { target c++17_down } .-2 }
+ tc++;
+ return ((ta + tc + td) + ... + tb); // { dg-warning "fold-expressions only available with" "" { target c++14_down } }
+}
+
+int
+main ()
+{
+ if (foo <2> () != 15 || foo <2> () != 16 || foo <2> () != 17
+ || foo <42> () != 175 || foo <42> () != 176
+ || bar <5> () != 19 || bar <5> () != 20 || bar <5> () != 21
+ || bar <18> () != 58 || bar <18> () != 59
+ || baz <3> () != 13 || baz <3> () != 14 || baz <3> () != 15
+ || baz <22> () != 70 || baz <22> () != 71)
+ __builtin_abort ();
+ if (qux <2> () != 15 || qux <2> () != 16 || qux <2> () != 17
+ || qux <42> () != 175 || qux <42> () != 176
+ || freddy <5> () != 19 || freddy <5> () != 20 || freddy <5> () != 21
+ || freddy <18> () != 58 || freddy <18> () != 59
+ || corge <3> () != 13 || corge <3> () != 14 || corge <3> () != 15
+ || corge <22> () != 70 || corge <22> () != 71)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp19.C b/gcc/testsuite/g++.dg/cpp26/decomp19.C
new file mode 100644
index 0000000..b4d97a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp19.C
@@ -0,0 +1,46 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+namespace std {
+ template <typename T> struct tuple_size;
+ template <int, typename> struct tuple_element;
+}
+struct T {
+ int a[3];
+ template <int I>
+ int &get () { return a[2 - I]; }
+};
+template <>
+struct std::tuple_size<T> { static constexpr int value = 3; };
+template <int N>
+struct std::tuple_element<N, T> { typedef int type; };
+
+template <int N>
+inline void
+foo ()
+{
+ static T t = { { N, N + 1, N + 2 } };
+ static auto [ta, ...tb, tc] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'static' only in" "" { target c++17_down } .-2 }
+ // { dg-message "mangling of structured binding pack elements not implemented yet" "" { target *-*-* } .-3 }
+}
+
+template <int N>
+inline void
+bar ()
+{
+ thread_local T t = { { N, N + 1, N + 2 } };
+ thread_local auto [...ta] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured binding declaration can be 'thread_local' only in" "" { target c++17_down } .-2 }
+ // { dg-message "mangling of structured binding pack elements not implemented yet" "" { target *-*-* } .-3 }
+}
+
+int
+main ()
+{
+ foo <0> ();
+ bar <0> ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp20.C b/gcc/testsuite/g++.dg/cpp26/decomp20.C
new file mode 100644
index 0000000..5091e13
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp20.C
@@ -0,0 +1,53 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct S {
+ explicit operator bool () const noexcept { return true; }
+};
+namespace std {
+ template <typename T> struct tuple_size;
+ template <int, typename> struct tuple_element;
+}
+int x;
+struct T {
+ template <int I>
+ int &get () { return x; }
+ explicit operator bool () const noexcept { return false; }
+};
+template <>
+struct std::tuple_size<T> { static constexpr int value = 0; };
+template <int N>
+struct std::tuple_element<N, T> { typedef int type; };
+
+template <int N>
+void
+foo ()
+{
+ int a[0] = {};
+ auto [...aa] = a; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (aa) == 0, "");
+ S s = {};
+ auto [...sa] = s; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (sa) == 0, "");
+ T t = {};
+ auto [...ta] = t; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (ta) == 0, "");
+ if (auto [...sb] = s) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
+ static_assert (sizeof... (sb) == 0, "");
+ else
+ __builtin_abort ();
+ if (auto [...tb] = t) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
+ __builtin_abort ();
+ else
+ static_assert (sizeof... (tb) == 0, "");
+}
+
+int
+main ()
+{
+ foo <0> ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp21.C b/gcc/testsuite/g++.dg/cpp26/decomp21.C
new file mode 100644
index 0000000..6baa8aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/decomp21.C
@@ -0,0 +1,103 @@
+// P1061R10 - Structured Bindings can introduce a Pack
+// { dg-do run { target c++11 } }
+// { dg-options "" }
+
+using size_t = decltype (sizeof 0);
+
+auto g () -> int (&)[4]
+{
+ static int a[4] = { 1, 2, 3, 4 };
+ return a;
+}
+
+template <size_t N>
+void
+h (int (&arr)[N])
+{
+ auto [a, ...b, c] = arr; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (b) == 2, "");
+ auto &[f, ...g, h] = arr; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (g) == 2, "");
+ if (&f != &arr[0] || &h != &arr[3]
+ || &g...[0] != &arr[1] || &g...[1] != &arr[2]) // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ __builtin_abort ();
+ auto &[...e] = arr; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof ... (e) == 4, "");
+ if (&e...[0] != &arr[0] || &e...[3] != &arr[3]) // { dg-warning "pack indexing only available with" "" { target c++23_down } }
+ __builtin_abort ();
+}
+
+struct C { int x, y, z; };
+
+template <class T>
+void
+now_i_know_my ()
+{
+ auto [a, b, c] = C (); // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [d, ...e] = C (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (e) == 2, "");
+ auto [...f, g] = C (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (f) == 2, "");
+ auto [h, i, j, ...k] = C (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (k) == 0, "");
+// auto [l, m, n, o, ...p] = C ();
+}
+
+auto foo () -> int (&)[2]
+{
+ static int a[2] = { 1, 2 };
+ return a;
+}
+
+template <class T>
+void
+bar ()
+{
+ auto [...a] = foo (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (a) == 2, "");
+ auto [b, c, ...d] = foo (); // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ static_assert (sizeof... (d) == 0, "");
+}
+
+struct D { };
+
+void
+baz (...)
+{
+ __builtin_abort ();
+}
+
+template <typename T>
+void
+qux ()
+{
+ D arr[1] = {};
+ auto [...e] = arr; // { dg-warning "structured binding packs only available with" "" { target { c++17 && c++23_down } } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ baz (e...);
+}
+
+int d;
+
+void
+baz (D)
+{
+ d = 1;
+}
+
+int
+main ()
+{
+ h (g ());
+ now_i_know_my <int> ();
+ bar <int> ();
+ qux <int> ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C b/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
index cfc5f61..9284bc2 100644
--- a/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
+++ b/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
@@ -395,8 +395,8 @@
#ifndef __cpp_structured_bindings
# error "__cpp_structured_bindings"
-#elif __cpp_structured_bindings != 202403
-# error "__cpp_structured_bindings != 202403"
+#elif __cpp_structured_bindings != 202411
+# error "__cpp_structured_bindings != 202411"
#endif
#ifndef __cpp_template_template_args
diff --git a/gcc/testsuite/g++.dg/modules/atom-preamble-3.C b/gcc/testsuite/g++.dg/modules/atom-preamble-3.C
index 74dba7d..915fa74 100644
--- a/gcc/testsuite/g++.dg/modules/atom-preamble-3.C
+++ b/gcc/testsuite/g++.dg/modules/atom-preamble-3.C
@@ -1,4 +1,4 @@
-// { dg-additional-options "-fmodules-ts" }
+// { dg-additional-options "-fmodules-ts -Wno-keyword-macro" }
#define import import
import malcolm; // { dg-error "object-like macro" }
// { dg-error "failed to read" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/modules/class-11_a.H b/gcc/testsuite/g++.dg/modules/class-11_a.H
index 799dbdd..43fddb6 100644
--- a/gcc/testsuite/g++.dg/modules/class-11_a.H
+++ b/gcc/testsuite/g++.dg/modules/class-11_a.H
@@ -1,6 +1,7 @@
// Check for some additional lang_type flags that we'd missed.
// { dg-additional-options "-fmodule-header -fabi-version=21 -Wabi=15" }
// { dg-module-cmi {} }
+// { dg-skip-if "test assumes that structs have padding" { default_packed } }
#if __cpp_trivial_relocatability < 202502L
#define trivially_relocatable_if_eligible __trivially_relocatable_if_eligible
diff --git a/gcc/testsuite/g++.dg/modules/class-11_b.C b/gcc/testsuite/g++.dg/modules/class-11_b.C
index 2450a45..87be71a 100644
--- a/gcc/testsuite/g++.dg/modules/class-11_b.C
+++ b/gcc/testsuite/g++.dg/modules/class-11_b.C
@@ -1,4 +1,5 @@
// { dg-additional-options "-fmodules -fabi-version=21 -Wabi=15" }
+// { dg-skip-if "test assumes that structs have padding" { default_packed } }
import "class-11_a.H";
diff --git a/gcc/testsuite/g++.dg/opt/pr82577.C b/gcc/testsuite/g++.dg/opt/pr82577.C
index 1a06897..8a4f36d 100644
--- a/gcc/testsuite/g++.dg/opt/pr82577.C
+++ b/gcc/testsuite/g++.dg/opt/pr82577.C
@@ -3,7 +3,9 @@
#if __cplusplus > 201500L
// register is no longer a keyword in C++17.
-#define register
+#define reg
+#else
+#define reg register
#endif
class a {
@@ -14,8 +16,8 @@ struct c {
int d;
a e;
} f;
-void fn1(register c *g) {
- register int *h;
+void fn1(reg c *g) {
+ reg int *h;
do
(h) = g->e.b() + (g)->d;
while (&f);
diff --git a/gcc/testsuite/g++.dg/template/sfinae17.C b/gcc/testsuite/g++.dg/template/sfinae17.C
index eb043cb..8628726 100644
--- a/gcc/testsuite/g++.dg/template/sfinae17.C
+++ b/gcc/testsuite/g++.dg/template/sfinae17.C
@@ -1,7 +1,7 @@
// The conversion from D* to B* is ambiguous, but that should not produce
// an error, it should remove the first f overload by SFINAE.
-#define static_assert(TEST,STR) \
+#define my_static_assert(TEST,STR) \
do { int ar[(TEST)?1:-1]; } while (0);
struct B {};
@@ -23,6 +23,6 @@ template <class T>
int main()
{
- static_assert(sizeof f<int>(0) == sizeof(two), "");
- static_assert(sizeof f<B *>(0) == sizeof(two), "");
+ my_static_assert(sizeof f<int>(0) == sizeof(two), "");
+ my_static_assert(sizeof f<B *>(0) == sizeof(two), "");
}
diff --git a/gcc/testsuite/g++.dg/torture/noncall-eh-1.C b/gcc/testsuite/g++.dg/torture/noncall-eh-1.C
new file mode 100644
index 0000000..ea8fd79
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/noncall-eh-1.C
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// For slim LTO there's no optimized dump
+// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
+// { dg-additional-options "-fnon-call-exceptions -fexceptions -fdump-tree-optimized-eh" }
+
+// PR tree-optimization/120599
+// Copying prop for aggregates should not touch `a = *__val` since that statement
+// can throw (internally) so we need to be able to keep the landing pad.
+
+struct RefitOption {
+ char subtype;
+ int string;
+} n;
+void h(RefitOption) __attribute__((nothrow));
+void k(RefitOption *__val, RefitOption a)
+{
+ try {
+ a = *__val;
+ RefitOption __trans_tmp_2 = a;
+ h(__trans_tmp_2);
+ }
+ catch(...){}
+}
+
+// Make sure There is a landing pad for the non-call exception from the aggregate load.
+// { dg-final { scan-tree-dump "LP " "optimized" } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-1.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-1.C
new file mode 100644
index 0000000..f47de7a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-1.C
@@ -0,0 +1,112 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+// [lex.key]
+#define alignas 1 // { dg-error "keyword 'alignas' defined as macro" "" { target c++26 } }
+#define alignof 1 // { dg-error "keyword 'alignof' defined as macro" "" { target c++26 } }
+#define asm 1 // { dg-error "keyword 'asm' defined as macro" "" { target c++26 } }
+#define auto 1 // { dg-error "keyword 'auto' defined as macro" "" { target c++26 } }
+#define bool 1 // { dg-error "keyword 'bool' defined as macro" "" { target c++26 } }
+#define break 1 // { dg-error "keyword 'break' defined as macro" "" { target c++26 } }
+#define case 1 // { dg-error "keyword 'case' defined as macro" "" { target c++26 } }
+#define catch 1 // { dg-error "keyword 'catch' defined as macro" "" { target c++26 } }
+#define char 1 // { dg-error "keyword 'char' defined as macro" "" { target c++26 } }
+#define char16_t 1 // { dg-error "keyword 'char16_t' defined as macro" "" { target c++26 } }
+#define char32_t 1 // { dg-error "keyword 'char32_t' defined as macro" "" { target c++26 } }
+#define char8_t 1 // { dg-error "keyword 'char8_t' defined as macro" "" { target c++26 } }
+#define class 1 // { dg-error "keyword 'class' defined as macro" "" { target c++26 } }
+#define co_await 1 // { dg-error "keyword 'co_await' defined as macro" "" { target c++26 } }
+#define concept 1 // { dg-error "keyword 'concept' defined as macro" "" { target c++26 } }
+#define const 1 // { dg-error "keyword 'const' defined as macro" "" { target c++26 } }
+#define const_cast 1 // { dg-error "keyword 'const_cast' defined as macro" "" { target c++26 } }
+#define consteval 1 // { dg-error "keyword 'consteval' defined as macro" "" { target c++26 } }
+#define constexpr 1 // { dg-error "keyword 'constexpr' defined as macro" "" { target c++26 } }
+#define constinit 1 // { dg-error "keyword 'constinit' defined as macro" "" { target c++26 } }
+#define continue 1 // { dg-error "keyword 'continue' defined as macro" "" { target c++26 } }
+#define contract_assert 1
+#define co_return 1 // { dg-error "keyword 'co_return' defined as macro" "" { target c++26 } }
+#define co_yield 1 // { dg-error "keyword 'co_yield' defined as macro" "" { target c++26 } }
+#define decltype 1 // { dg-error "keyword 'decltype' defined as macro" "" { target c++26 } }
+#define default 1 // { dg-error "keyword 'default' defined as macro" "" { target c++26 } }
+#define delete 1 // { dg-error "keyword 'delete' defined as macro" "" { target c++26 } }
+#define do 1 // { dg-error "keyword 'do' defined as macro" "" { target c++26 } }
+#define double 1 // { dg-error "keyword 'double' defined as macro" "" { target c++26 } }
+#define dynamic_cast 1 // { dg-error "keyword 'dynamic_cast' defined as macro" "" { target c++26 } }
+#define else 1 // { dg-error "keyword 'else' defined as macro" "" { target c++26 } }
+#define enum 1 // { dg-error "keyword 'enum' defined as macro" "" { target c++26 } }
+#define explicit 1 // { dg-error "keyword 'explicit' defined as macro" "" { target c++26 } }
+#define export 1 // { dg-error "keyword 'export' defined as macro" "" { target c++26 } }
+#define extern 1 // { dg-error "keyword 'extern' defined as macro" "" { target c++26 } }
+#define false 1 // { dg-error "keyword 'false' defined as macro" "" { target c++26 } }
+#define float 1 // { dg-error "keyword 'float' defined as macro" "" { target c++26 } }
+#define for 1 // { dg-error "keyword 'for' defined as macro" "" { target c++26 } }
+#define friend 1 // { dg-error "keyword 'friend' defined as macro" "" { target c++26 } }
+#define goto 1 // { dg-error "keyword 'goto' defined as macro" "" { target c++26 } }
+#define if 1 // { dg-error "keyword 'if' defined as macro" "" { target c++26 } }
+#define inline 1 // { dg-error "keyword 'inline' defined as macro" "" { target c++26 } }
+#define int 1 // { dg-error "keyword 'int' defined as macro" "" { target c++26 } }
+#define long 1 // { dg-error "keyword 'long' defined as macro" "" { target c++26 } }
+#define mutable 1 // { dg-error "keyword 'mutable' defined as macro" "" { target c++26 } }
+#define namespace 1 // { dg-error "keyword 'namespace' defined as macro" "" { target c++26 } }
+#define new 1 // { dg-error "keyword 'new' defined as macro" "" { target c++26 } }
+#define noexcept 1 // { dg-error "keyword 'noexcept' defined as macro" "" { target c++26 } }
+#define nullptr 1 // { dg-error "keyword 'nullptr' defined as macro" "" { target c++26 } }
+#define operator 1 // { dg-error "keyword 'operator' defined as macro" "" { target c++26 } }
+#define private 1 // { dg-error "keyword 'private' defined as macro" "" { target c++26 } }
+#define protected 1 // { dg-error "keyword 'protected' defined as macro" "" { target c++26 } }
+#define public 1 // { dg-error "keyword 'public' defined as macro" "" { target c++26 } }
+#define register 1 // { dg-error "keyword 'register' defined as macro" "" { target c++26 } }
+#define reinterpret_cast 1 // { dg-error "keyword 'reinterpret_cast' defined as macro" "" { target c++26 } }
+#define requires 1 // { dg-error "keyword 'requires' defined as macro" "" { target c++26 } }
+#define return 1 // { dg-error "keyword 'return' defined as macro" "" { target c++26 } }
+#define short 1 // { dg-error "keyword 'short' defined as macro" "" { target c++26 } }
+#define signed 1 // { dg-error "keyword 'signed' defined as macro" "" { target c++26 } }
+#define sizeof 1 // { dg-error "keyword 'sizeof' defined as macro" "" { target c++26 } }
+#define static 1 // { dg-error "keyword 'static' defined as macro" "" { target c++26 } }
+#define static_assert 1 // { dg-error "keyword 'static_assert' defined as macro" "" { target c++26 } }
+#define static_cast 1 // { dg-error "keyword 'static_cast' defined as macro" "" { target c++26 } }
+#define struct 1 // { dg-error "keyword 'struct' defined as macro" "" { target c++26 } }
+#define switch 1 // { dg-error "keyword 'switch' defined as macro" "" { target c++26 } }
+#define template 1 // { dg-error "keyword 'template' defined as macro" "" { target c++26 } }
+#define this 1 // { dg-error "keyword 'this' defined as macro" "" { target c++26 } }
+#define thread_local 1 // { dg-error "keyword 'thread_local' defined as macro" "" { target c++26 } }
+#define throw 1 // { dg-error "keyword 'throw' defined as macro" "" { target c++26 } }
+#define true 1 // { dg-error "keyword 'true' defined as macro" "" { target c++26 } }
+#define try 1 // { dg-error "keyword 'try' defined as macro" "" { target c++26 } }
+#define typedef 1 // { dg-error "keyword 'typedef' defined as macro" "" { target c++26 } }
+#define typeid 1 // { dg-error "keyword 'typeid' defined as macro" "" { target c++26 } }
+#define typename 1 // { dg-error "keyword 'typename' defined as macro" "" { target c++26 } }
+#define union 1 // { dg-error "keyword 'union' defined as macro" "" { target c++26 } }
+#define unsigned 1 // { dg-error "keyword 'unsigned' defined as macro" "" { target c++26 } }
+#define using 1 // { dg-error "keyword 'using' defined as macro" "" { target c++26 } }
+#define virtual 1 // { dg-error "keyword 'virtual' defined as macro" "" { target c++26 } }
+#define void 1 // { dg-error "keyword 'void' defined as macro" "" { target c++26 } }
+#define volatile 1 // { dg-error "keyword 'volatile' defined as macro" "" { target c++26 } }
+#define wchar_t 1 // { dg-error "keyword 'wchar_t' defined as macro" "" { target c++26 } }
+#define while 1 // { dg-error "keyword 'while' defined as macro" "" { target c++26 } }
+
+// [lex.name]
+#define final 1 // { dg-error "keyword 'final' defined as macro" "" { target c++26 } }
+#define import 1 // { dg-error "keyword 'import' defined as macro" "" { target c++26 } }
+#define module 1 // { dg-error "keyword 'module' defined as macro" "" { target c++26 } }
+#define override 1 // { dg-error "keyword 'override' defined as macro" "" { target c++26 } }
+#define post 1
+#define pre 1
+#define replaceable_if_eligible 1 // { dg-error "keyword 'replaceable_if_eligible' defined as macro" "" { target c++26 } }
+#define trivially_relocatable_if_eligible 1 // { dg-error "keyword 'trivially_relocatable_if_eligible' defined as macro" "" { target c++26 } }
+
+// [dcl.attr]
+#define assume 1 // { dg-error "keyword 'assume' defined as macro" "" { target c++26 } }
+#define carries_dependency 1
+#define deprecated 1 // { dg-error "keyword 'deprecated' defined as macro" "" { target c++26 } }
+#define fallthrough 1 // { dg-error "keyword 'fallthrough' defined as macro" "" { target c++26 } }
+#define indeterminate 1
+#define likely 1 // { dg-error "keyword 'likely' defined as macro" "" { target c++26 } }
+#define maybe_unused 1 // { dg-error "keyword 'maybe_unused' defined as macro" "" { target c++26 } }
+#define nodiscard 1 // { dg-error "keyword 'nodiscard' defined as macro" "" { target c++26 } }
+#define noreturn 1 // { dg-error "keyword 'noreturn' defined as macro" "" { target c++26 } }
+#define no_unique_address 1 // { dg-error "keyword 'no_unique_address' defined as macro" "" { target c++26 } }
+#define unlikely 1 // { dg-error "keyword 'unlikely' defined as macro" "" { target c++26 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-10.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-10.C
new file mode 100644
index 0000000..e6fafcd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-10.C
@@ -0,0 +1,23 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro" }
+
+#undef for // { dg-warning "undefining keyword 'for'" }
+#define for for // { dg-warning "keyword 'for' defined as macro" }
+#undef for // { dg-warning "undefining keyword 'for'" }
+#define while do // { dg-warning "keyword 'while' defined as macro" }
+#define while do // { dg-warning "keyword 'while' defined as macro" }
+#define while for // { dg-warning "keyword 'while' defined as macro" }
+ // { dg-warning "'while' redefined" "" { target *-*-* } .-1 }
+#undef while // { dg-warning "undefining keyword 'while'" }
+#define while while // { dg-warning "keyword 'while' defined as macro" }
+#define private public // { dg-warning "keyword 'private' defined as macro" }
+#define inline // { dg-warning "keyword 'inline' defined as macro" }
+#undef inline // { dg-warning "undefining keyword 'inline'" }
+#define inline __inline__ __attribute__((__always_inline__)) // { dg-warning "keyword 'inline' defined as macro" }
+#define likely(a) a
+#undef likely // { dg-warning "undefining keyword 'likely'" "" { target c++20 } }
+#define unlikely(a, b, c) a + b + c
+#define unlikely(a, b, c) a + b + c
+#undef unlikely // { dg-warning "undefining keyword 'unlikely'" "" { target c++20 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-2.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-2.C
new file mode 100644
index 0000000..b1a9aa2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-2.C
@@ -0,0 +1,112 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-pedantic" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+// [lex.key]
+#define alignas 1 // { dg-warning "keyword 'alignas' defined as macro" "" { target c++26 } }
+#define alignof 1 // { dg-warning "keyword 'alignof' defined as macro" "" { target c++26 } }
+#define asm 1 // { dg-warning "keyword 'asm' defined as macro" "" { target c++26 } }
+#define auto 1 // { dg-warning "keyword 'auto' defined as macro" "" { target c++26 } }
+#define bool 1 // { dg-warning "keyword 'bool' defined as macro" "" { target c++26 } }
+#define break 1 // { dg-warning "keyword 'break' defined as macro" "" { target c++26 } }
+#define case 1 // { dg-warning "keyword 'case' defined as macro" "" { target c++26 } }
+#define catch 1 // { dg-warning "keyword 'catch' defined as macro" "" { target c++26 } }
+#define char 1 // { dg-warning "keyword 'char' defined as macro" "" { target c++26 } }
+#define char16_t 1 // { dg-warning "keyword 'char16_t' defined as macro" "" { target c++26 } }
+#define char32_t 1 // { dg-warning "keyword 'char32_t' defined as macro" "" { target c++26 } }
+#define char8_t 1 // { dg-warning "keyword 'char8_t' defined as macro" "" { target c++26 } }
+#define class 1 // { dg-warning "keyword 'class' defined as macro" "" { target c++26 } }
+#define co_await 1 // { dg-warning "keyword 'co_await' defined as macro" "" { target c++26 } }
+#define concept 1 // { dg-warning "keyword 'concept' defined as macro" "" { target c++26 } }
+#define const 1 // { dg-warning "keyword 'const' defined as macro" "" { target c++26 } }
+#define const_cast 1 // { dg-warning "keyword 'const_cast' defined as macro" "" { target c++26 } }
+#define consteval 1 // { dg-warning "keyword 'consteval' defined as macro" "" { target c++26 } }
+#define constexpr 1 // { dg-warning "keyword 'constexpr' defined as macro" "" { target c++26 } }
+#define constinit 1 // { dg-warning "keyword 'constinit' defined as macro" "" { target c++26 } }
+#define continue 1 // { dg-warning "keyword 'continue' defined as macro" "" { target c++26 } }
+#define contract_assert 1
+#define co_return 1 // { dg-warning "keyword 'co_return' defined as macro" "" { target c++26 } }
+#define co_yield 1 // { dg-warning "keyword 'co_yield' defined as macro" "" { target c++26 } }
+#define decltype 1 // { dg-warning "keyword 'decltype' defined as macro" "" { target c++26 } }
+#define default 1 // { dg-warning "keyword 'default' defined as macro" "" { target c++26 } }
+#define delete 1 // { dg-warning "keyword 'delete' defined as macro" "" { target c++26 } }
+#define do 1 // { dg-warning "keyword 'do' defined as macro" "" { target c++26 } }
+#define double 1 // { dg-warning "keyword 'double' defined as macro" "" { target c++26 } }
+#define dynamic_cast 1 // { dg-warning "keyword 'dynamic_cast' defined as macro" "" { target c++26 } }
+#define else 1 // { dg-warning "keyword 'else' defined as macro" "" { target c++26 } }
+#define enum 1 // { dg-warning "keyword 'enum' defined as macro" "" { target c++26 } }
+#define explicit 1 // { dg-warning "keyword 'explicit' defined as macro" "" { target c++26 } }
+#define export 1 // { dg-warning "keyword 'export' defined as macro" "" { target c++26 } }
+#define extern 1 // { dg-warning "keyword 'extern' defined as macro" "" { target c++26 } }
+#define false 1 // { dg-warning "keyword 'false' defined as macro" "" { target c++26 } }
+#define float 1 // { dg-warning "keyword 'float' defined as macro" "" { target c++26 } }
+#define for 1 // { dg-warning "keyword 'for' defined as macro" "" { target c++26 } }
+#define friend 1 // { dg-warning "keyword 'friend' defined as macro" "" { target c++26 } }
+#define goto 1 // { dg-warning "keyword 'goto' defined as macro" "" { target c++26 } }
+#define if 1 // { dg-warning "keyword 'if' defined as macro" "" { target c++26 } }
+#define inline 1 // { dg-warning "keyword 'inline' defined as macro" "" { target c++26 } }
+#define int 1 // { dg-warning "keyword 'int' defined as macro" "" { target c++26 } }
+#define long 1 // { dg-warning "keyword 'long' defined as macro" "" { target c++26 } }
+#define mutable 1 // { dg-warning "keyword 'mutable' defined as macro" "" { target c++26 } }
+#define namespace 1 // { dg-warning "keyword 'namespace' defined as macro" "" { target c++26 } }
+#define new 1 // { dg-warning "keyword 'new' defined as macro" "" { target c++26 } }
+#define noexcept 1 // { dg-warning "keyword 'noexcept' defined as macro" "" { target c++26 } }
+#define nullptr 1 // { dg-warning "keyword 'nullptr' defined as macro" "" { target c++26 } }
+#define operator 1 // { dg-warning "keyword 'operator' defined as macro" "" { target c++26 } }
+#define private 1 // { dg-warning "keyword 'private' defined as macro" "" { target c++26 } }
+#define protected 1 // { dg-warning "keyword 'protected' defined as macro" "" { target c++26 } }
+#define public 1 // { dg-warning "keyword 'public' defined as macro" "" { target c++26 } }
+#define register 1 // { dg-warning "keyword 'register' defined as macro" "" { target c++26 } }
+#define reinterpret_cast 1 // { dg-warning "keyword 'reinterpret_cast' defined as macro" "" { target c++26 } }
+#define requires 1 // { dg-warning "keyword 'requires' defined as macro" "" { target c++26 } }
+#define return 1 // { dg-warning "keyword 'return' defined as macro" "" { target c++26 } }
+#define short 1 // { dg-warning "keyword 'short' defined as macro" "" { target c++26 } }
+#define signed 1 // { dg-warning "keyword 'signed' defined as macro" "" { target c++26 } }
+#define sizeof 1 // { dg-warning "keyword 'sizeof' defined as macro" "" { target c++26 } }
+#define static 1 // { dg-warning "keyword 'static' defined as macro" "" { target c++26 } }
+#define static_assert 1 // { dg-warning "keyword 'static_assert' defined as macro" "" { target c++26 } }
+#define static_cast 1 // { dg-warning "keyword 'static_cast' defined as macro" "" { target c++26 } }
+#define struct 1 // { dg-warning "keyword 'struct' defined as macro" "" { target c++26 } }
+#define switch 1 // { dg-warning "keyword 'switch' defined as macro" "" { target c++26 } }
+#define template 1 // { dg-warning "keyword 'template' defined as macro" "" { target c++26 } }
+#define this 1 // { dg-warning "keyword 'this' defined as macro" "" { target c++26 } }
+#define thread_local 1 // { dg-warning "keyword 'thread_local' defined as macro" "" { target c++26 } }
+#define throw 1 // { dg-warning "keyword 'throw' defined as macro" "" { target c++26 } }
+#define true 1 // { dg-warning "keyword 'true' defined as macro" "" { target c++26 } }
+#define try 1 // { dg-warning "keyword 'try' defined as macro" "" { target c++26 } }
+#define typedef 1 // { dg-warning "keyword 'typedef' defined as macro" "" { target c++26 } }
+#define typeid 1 // { dg-warning "keyword 'typeid' defined as macro" "" { target c++26 } }
+#define typename 1 // { dg-warning "keyword 'typename' defined as macro" "" { target c++26 } }
+#define union 1 // { dg-warning "keyword 'union' defined as macro" "" { target c++26 } }
+#define unsigned 1 // { dg-warning "keyword 'unsigned' defined as macro" "" { target c++26 } }
+#define using 1 // { dg-warning "keyword 'using' defined as macro" "" { target c++26 } }
+#define virtual 1 // { dg-warning "keyword 'virtual' defined as macro" "" { target c++26 } }
+#define void 1 // { dg-warning "keyword 'void' defined as macro" "" { target c++26 } }
+#define volatile 1 // { dg-warning "keyword 'volatile' defined as macro" "" { target c++26 } }
+#define wchar_t 1 // { dg-warning "keyword 'wchar_t' defined as macro" "" { target c++26 } }
+#define while 1 // { dg-warning "keyword 'while' defined as macro" "" { target c++26 } }
+
+// [lex.name]
+#define final 1 // { dg-warning "keyword 'final' defined as macro" "" { target c++26 } }
+#define import 1 // { dg-warning "keyword 'import' defined as macro" "" { target c++26 } }
+#define module 1 // { dg-warning "keyword 'module' defined as macro" "" { target c++26 } }
+#define override 1 // { dg-warning "keyword 'override' defined as macro" "" { target c++26 } }
+#define post 1
+#define pre 1
+#define replaceable_if_eligible 1 // { dg-warning "keyword 'replaceable_if_eligible' defined as macro" "" { target c++26 } }
+#define trivially_relocatable_if_eligible 1 // { dg-warning "keyword 'trivially_relocatable_if_eligible' defined as macro" "" { target c++26 } }
+
+// [dcl.attr]
+#define assume 1 // { dg-warning "keyword 'assume' defined as macro" "" { target c++26 } }
+#define carries_dependency 1
+#define deprecated 1 // { dg-warning "keyword 'deprecated' defined as macro" "" { target c++26 } }
+#define fallthrough 1 // { dg-warning "keyword 'fallthrough' defined as macro" "" { target c++26 } }
+#define indeterminate 1
+#define likely 1 // { dg-warning "keyword 'likely' defined as macro" "" { target c++26 } }
+#define maybe_unused 1 // { dg-warning "keyword 'maybe_unused' defined as macro" "" { target c++26 } }
+#define nodiscard 1 // { dg-warning "keyword 'nodiscard' defined as macro" "" { target c++26 } }
+#define noreturn 1 // { dg-warning "keyword 'noreturn' defined as macro" "" { target c++26 } }
+#define no_unique_address 1 // { dg-warning "keyword 'no_unique_address' defined as macro" "" { target c++26 } }
+#define unlikely 1 // { dg-warning "keyword 'unlikely' defined as macro" "" { target c++26 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-3.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-3.C
new file mode 100644
index 0000000..8576b64
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-3.C
@@ -0,0 +1,7 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+#include "Wkeyword-macro-1.C"
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-4.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-4.C
new file mode 100644
index 0000000..9ff974d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-4.C
@@ -0,0 +1,112 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+// [lex.key]
+#undef alignas // { dg-error "undefining keyword 'alignas'" "" { target c++26 } }
+#undef alignof // { dg-error "undefining keyword 'alignof'" "" { target c++26 } }
+#undef asm // { dg-error "undefining keyword 'asm'" "" { target c++26 } }
+#undef auto // { dg-error "undefining keyword 'auto'" "" { target c++26 } }
+#undef bool // { dg-error "undefining keyword 'bool'" "" { target c++26 } }
+#undef break // { dg-error "undefining keyword 'break'" "" { target c++26 } }
+#undef case // { dg-error "undefining keyword 'case'" "" { target c++26 } }
+#undef catch // { dg-error "undefining keyword 'catch'" "" { target c++26 } }
+#undef char // { dg-error "undefining keyword 'char'" "" { target c++26 } }
+#undef char16_t // { dg-error "undefining keyword 'char16_t'" "" { target c++26 } }
+#undef char32_t // { dg-error "undefining keyword 'char32_t'" "" { target c++26 } }
+#undef char8_t // { dg-error "undefining keyword 'char8_t'" "" { target c++26 } }
+#undef class // { dg-error "undefining keyword 'class'" "" { target c++26 } }
+#undef co_await // { dg-error "undefining keyword 'co_await'" "" { target c++26 } }
+#undef concept // { dg-error "undefining keyword 'concept'" "" { target c++26 } }
+#undef const // { dg-error "undefining keyword 'const'" "" { target c++26 } }
+#undef const_cast // { dg-error "undefining keyword 'const_cast'" "" { target c++26 } }
+#undef consteval // { dg-error "undefining keyword 'consteval'" "" { target c++26 } }
+#undef constexpr // { dg-error "undefining keyword 'constexpr'" "" { target c++26 } }
+#undef constinit // { dg-error "undefining keyword 'constinit'" "" { target c++26 } }
+#undef continue // { dg-error "undefining keyword 'continue'" "" { target c++26 } }
+#undef contract_assert
+#undef co_return // { dg-error "undefining keyword 'co_return'" "" { target c++26 } }
+#undef co_yield // { dg-error "undefining keyword 'co_yield'" "" { target c++26 } }
+#undef decltype // { dg-error "undefining keyword 'decltype'" "" { target c++26 } }
+#undef default // { dg-error "undefining keyword 'default'" "" { target c++26 } }
+#undef delete // { dg-error "undefining keyword 'delete'" "" { target c++26 } }
+#undef do // { dg-error "undefining keyword 'do'" "" { target c++26 } }
+#undef double // { dg-error "undefining keyword 'double'" "" { target c++26 } }
+#undef dynamic_cast // { dg-error "undefining keyword 'dynamic_cast'" "" { target c++26 } }
+#undef else // { dg-error "undefining keyword 'else'" "" { target c++26 } }
+#undef enum // { dg-error "undefining keyword 'enum'" "" { target c++26 } }
+#undef explicit // { dg-error "undefining keyword 'explicit'" "" { target c++26 } }
+#undef export // { dg-error "undefining keyword 'export'" "" { target c++26 } }
+#undef extern // { dg-error "undefining keyword 'extern'" "" { target c++26 } }
+#undef false // { dg-error "undefining keyword 'false'" "" { target c++26 } }
+#undef float // { dg-error "undefining keyword 'float'" "" { target c++26 } }
+#undef for // { dg-error "undefining keyword 'for'" "" { target c++26 } }
+#undef friend // { dg-error "undefining keyword 'friend'" "" { target c++26 } }
+#undef goto // { dg-error "undefining keyword 'goto'" "" { target c++26 } }
+#undef if // { dg-error "undefining keyword 'if'" "" { target c++26 } }
+#undef inline // { dg-error "undefining keyword 'inline'" "" { target c++26 } }
+#undef int // { dg-error "undefining keyword 'int'" "" { target c++26 } }
+#undef long // { dg-error "undefining keyword 'long'" "" { target c++26 } }
+#undef mutable // { dg-error "undefining keyword 'mutable'" "" { target c++26 } }
+#undef namespace // { dg-error "undefining keyword 'namespace'" "" { target c++26 } }
+#undef new // { dg-error "undefining keyword 'new'" "" { target c++26 } }
+#undef noexcept // { dg-error "undefining keyword 'noexcept'" "" { target c++26 } }
+#undef nullptr // { dg-error "undefining keyword 'nullptr'" "" { target c++26 } }
+#undef operator // { dg-error "undefining keyword 'operator'" "" { target c++26 } }
+#undef private // { dg-error "undefining keyword 'private'" "" { target c++26 } }
+#undef protected // { dg-error "undefining keyword 'protected'" "" { target c++26 } }
+#undef public // { dg-error "undefining keyword 'public'" "" { target c++26 } }
+#undef register // { dg-error "undefining keyword 'register'" "" { target c++26 } }
+#undef reinterpret_cast // { dg-error "undefining keyword 'reinterpret_cast'" "" { target c++26 } }
+#undef requires // { dg-error "undefining keyword 'requires'" "" { target c++26 } }
+#undef return // { dg-error "undefining keyword 'return'" "" { target c++26 } }
+#undef short // { dg-error "undefining keyword 'short'" "" { target c++26 } }
+#undef signed // { dg-error "undefining keyword 'signed'" "" { target c++26 } }
+#undef sizeof // { dg-error "undefining keyword 'sizeof'" "" { target c++26 } }
+#undef static // { dg-error "undefining keyword 'static'" "" { target c++26 } }
+#undef static_assert // { dg-error "undefining keyword 'static_assert'" "" { target c++26 } }
+#undef static_cast // { dg-error "undefining keyword 'static_cast'" "" { target c++26 } }
+#undef struct // { dg-error "undefining keyword 'struct'" "" { target c++26 } }
+#undef switch // { dg-error "undefining keyword 'switch'" "" { target c++26 } }
+#undef template // { dg-error "undefining keyword 'template'" "" { target c++26 } }
+#undef this // { dg-error "undefining keyword 'this'" "" { target c++26 } }
+#undef thread_local // { dg-error "undefining keyword 'thread_local'" "" { target c++26 } }
+#undef throw // { dg-error "undefining keyword 'throw'" "" { target c++26 } }
+#undef true // { dg-error "undefining keyword 'true'" "" { target c++26 } }
+#undef try // { dg-error "undefining keyword 'try'" "" { target c++26 } }
+#undef typedef // { dg-error "undefining keyword 'typedef'" "" { target c++26 } }
+#undef typeid // { dg-error "undefining keyword 'typeid'" "" { target c++26 } }
+#undef typename // { dg-error "undefining keyword 'typename'" "" { target c++26 } }
+#undef union // { dg-error "undefining keyword 'union'" "" { target c++26 } }
+#undef unsigned // { dg-error "undefining keyword 'unsigned'" "" { target c++26 } }
+#undef using // { dg-error "undefining keyword 'using'" "" { target c++26 } }
+#undef virtual // { dg-error "undefining keyword 'virtual'" "" { target c++26 } }
+#undef void // { dg-error "undefining keyword 'void'" "" { target c++26 } }
+#undef volatile // { dg-error "undefining keyword 'volatile'" "" { target c++26 } }
+#undef wchar_t // { dg-error "undefining keyword 'wchar_t'" "" { target c++26 } }
+#undef while // { dg-error "undefining keyword 'while'" "" { target c++26 } }
+
+// [lex.name]
+#undef final // { dg-error "undefining keyword 'final'" "" { target c++26 } }
+#undef import // { dg-error "undefining keyword 'import'" "" { target c++26 } }
+#undef module // { dg-error "undefining keyword 'module'" "" { target c++26 } }
+#undef override // { dg-error "undefining keyword 'override'" "" { target c++26 } }
+#undef post
+#undef pre
+#undef replaceable_if_eligible // { dg-error "undefining keyword 'replaceable_if_eligible'" "" { target c++26 } }
+#undef trivially_relocatable_if_eligible // { dg-error "undefining keyword 'trivially_relocatable_if_eligible'" "" { target c++26 } }
+
+// [dcl.attr]
+#undef assume // { dg-error "undefining keyword 'assume'" "" { target c++26 } }
+#undef carries_dependency
+#undef deprecated // { dg-error "undefining keyword 'deprecated'" "" { target c++26 } }
+#undef fallthrough // { dg-error "undefining keyword 'fallthrough'" "" { target c++26 } }
+#undef indeterminate
+#undef likely // { dg-error "undefining keyword 'likely'" "" { target c++26 } }
+#undef maybe_unused // { dg-error "undefining keyword 'maybe_unused'" "" { target c++26 } }
+#undef nodiscard // { dg-error "undefining keyword 'nodiscard'" "" { target c++26 } }
+#undef noreturn // { dg-error "undefining keyword 'noreturn'" "" { target c++26 } }
+#undef no_unique_address // { dg-error "undefining keyword 'no_unique_address'" "" { target c++26 } }
+#undef unlikely // { dg-error "undefining keyword 'unlikely'" "" { target c++26 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-5.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-5.C
new file mode 100644
index 0000000..657797b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-5.C
@@ -0,0 +1,112 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-pedantic" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+// [lex.key]
+#undef alignas // { dg-warning "undefining keyword 'alignas'" "" { target c++26 } }
+#undef alignof // { dg-warning "undefining keyword 'alignof'" "" { target c++26 } }
+#undef asm // { dg-warning "undefining keyword 'asm'" "" { target c++26 } }
+#undef auto // { dg-warning "undefining keyword 'auto'" "" { target c++26 } }
+#undef bool // { dg-warning "undefining keyword 'bool'" "" { target c++26 } }
+#undef break // { dg-warning "undefining keyword 'break'" "" { target c++26 } }
+#undef case // { dg-warning "undefining keyword 'case'" "" { target c++26 } }
+#undef catch // { dg-warning "undefining keyword 'catch'" "" { target c++26 } }
+#undef char // { dg-warning "undefining keyword 'char'" "" { target c++26 } }
+#undef char16_t // { dg-warning "undefining keyword 'char16_t'" "" { target c++26 } }
+#undef char32_t // { dg-warning "undefining keyword 'char32_t'" "" { target c++26 } }
+#undef char8_t // { dg-warning "undefining keyword 'char8_t'" "" { target c++26 } }
+#undef class // { dg-warning "undefining keyword 'class'" "" { target c++26 } }
+#undef co_await // { dg-warning "undefining keyword 'co_await'" "" { target c++26 } }
+#undef concept // { dg-warning "undefining keyword 'concept'" "" { target c++26 } }
+#undef const // { dg-warning "undefining keyword 'const'" "" { target c++26 } }
+#undef const_cast // { dg-warning "undefining keyword 'const_cast'" "" { target c++26 } }
+#undef consteval // { dg-warning "undefining keyword 'consteval'" "" { target c++26 } }
+#undef constexpr // { dg-warning "undefining keyword 'constexpr'" "" { target c++26 } }
+#undef constinit // { dg-warning "undefining keyword 'constinit'" "" { target c++26 } }
+#undef continue // { dg-warning "undefining keyword 'continue'" "" { target c++26 } }
+#undef contract_assert
+#undef co_return // { dg-warning "undefining keyword 'co_return'" "" { target c++26 } }
+#undef co_yield // { dg-warning "undefining keyword 'co_yield'" "" { target c++26 } }
+#undef decltype // { dg-warning "undefining keyword 'decltype'" "" { target c++26 } }
+#undef default // { dg-warning "undefining keyword 'default'" "" { target c++26 } }
+#undef delete // { dg-warning "undefining keyword 'delete'" "" { target c++26 } }
+#undef do // { dg-warning "undefining keyword 'do'" "" { target c++26 } }
+#undef double // { dg-warning "undefining keyword 'double'" "" { target c++26 } }
+#undef dynamic_cast // { dg-warning "undefining keyword 'dynamic_cast'" "" { target c++26 } }
+#undef else // { dg-warning "undefining keyword 'else'" "" { target c++26 } }
+#undef enum // { dg-warning "undefining keyword 'enum'" "" { target c++26 } }
+#undef explicit // { dg-warning "undefining keyword 'explicit'" "" { target c++26 } }
+#undef export // { dg-warning "undefining keyword 'export'" "" { target c++26 } }
+#undef extern // { dg-warning "undefining keyword 'extern'" "" { target c++26 } }
+#undef false // { dg-warning "undefining keyword 'false'" "" { target c++26 } }
+#undef float // { dg-warning "undefining keyword 'float'" "" { target c++26 } }
+#undef for // { dg-warning "undefining keyword 'for'" "" { target c++26 } }
+#undef friend // { dg-warning "undefining keyword 'friend'" "" { target c++26 } }
+#undef goto // { dg-warning "undefining keyword 'goto'" "" { target c++26 } }
+#undef if // { dg-warning "undefining keyword 'if'" "" { target c++26 } }
+#undef inline // { dg-warning "undefining keyword 'inline'" "" { target c++26 } }
+#undef int // { dg-warning "undefining keyword 'int'" "" { target c++26 } }
+#undef long // { dg-warning "undefining keyword 'long'" "" { target c++26 } }
+#undef mutable // { dg-warning "undefining keyword 'mutable'" "" { target c++26 } }
+#undef namespace // { dg-warning "undefining keyword 'namespace'" "" { target c++26 } }
+#undef new // { dg-warning "undefining keyword 'new'" "" { target c++26 } }
+#undef noexcept // { dg-warning "undefining keyword 'noexcept'" "" { target c++26 } }
+#undef nullptr // { dg-warning "undefining keyword 'nullptr'" "" { target c++26 } }
+#undef operator // { dg-warning "undefining keyword 'operator'" "" { target c++26 } }
+#undef private // { dg-warning "undefining keyword 'private'" "" { target c++26 } }
+#undef protected // { dg-warning "undefining keyword 'protected'" "" { target c++26 } }
+#undef public // { dg-warning "undefining keyword 'public'" "" { target c++26 } }
+#undef register // { dg-warning "undefining keyword 'register'" "" { target c++26 } }
+#undef reinterpret_cast // { dg-warning "undefining keyword 'reinterpret_cast'" "" { target c++26 } }
+#undef requires // { dg-warning "undefining keyword 'requires'" "" { target c++26 } }
+#undef return // { dg-warning "undefining keyword 'return'" "" { target c++26 } }
+#undef short // { dg-warning "undefining keyword 'short'" "" { target c++26 } }
+#undef signed // { dg-warning "undefining keyword 'signed'" "" { target c++26 } }
+#undef sizeof // { dg-warning "undefining keyword 'sizeof'" "" { target c++26 } }
+#undef static // { dg-warning "undefining keyword 'static'" "" { target c++26 } }
+#undef static_assert // { dg-warning "undefining keyword 'static_assert'" "" { target c++26 } }
+#undef static_cast // { dg-warning "undefining keyword 'static_cast'" "" { target c++26 } }
+#undef struct // { dg-warning "undefining keyword 'struct'" "" { target c++26 } }
+#undef switch // { dg-warning "undefining keyword 'switch'" "" { target c++26 } }
+#undef template // { dg-warning "undefining keyword 'template'" "" { target c++26 } }
+#undef this // { dg-warning "undefining keyword 'this'" "" { target c++26 } }
+#undef thread_local // { dg-warning "undefining keyword 'thread_local'" "" { target c++26 } }
+#undef throw // { dg-warning "undefining keyword 'throw'" "" { target c++26 } }
+#undef true // { dg-warning "undefining keyword 'true'" "" { target c++26 } }
+#undef try // { dg-warning "undefining keyword 'try'" "" { target c++26 } }
+#undef typedef // { dg-warning "undefining keyword 'typedef'" "" { target c++26 } }
+#undef typeid // { dg-warning "undefining keyword 'typeid'" "" { target c++26 } }
+#undef typename // { dg-warning "undefining keyword 'typename'" "" { target c++26 } }
+#undef union // { dg-warning "undefining keyword 'union'" "" { target c++26 } }
+#undef unsigned // { dg-warning "undefining keyword 'unsigned'" "" { target c++26 } }
+#undef using // { dg-warning "undefining keyword 'using'" "" { target c++26 } }
+#undef virtual // { dg-warning "undefining keyword 'virtual'" "" { target c++26 } }
+#undef void // { dg-warning "undefining keyword 'void'" "" { target c++26 } }
+#undef volatile // { dg-warning "undefining keyword 'volatile'" "" { target c++26 } }
+#undef wchar_t // { dg-warning "undefining keyword 'wchar_t'" "" { target c++26 } }
+#undef while // { dg-warning "undefining keyword 'while'" "" { target c++26 } }
+
+// [lex.name]
+#undef final // { dg-warning "undefining keyword 'final'" "" { target c++26 } }
+#undef import // { dg-warning "undefining keyword 'import'" "" { target c++26 } }
+#undef module // { dg-warning "undefining keyword 'module'" "" { target c++26 } }
+#undef override // { dg-warning "undefining keyword 'override'" "" { target c++26 } }
+#undef post
+#undef pre
+#undef replaceable_if_eligible // { dg-warning "undefining keyword 'replaceable_if_eligible'" "" { target c++26 } }
+#undef trivially_relocatable_if_eligible // { dg-warning "undefining keyword 'trivially_relocatable_if_eligible'" "" { target c++26 } }
+
+// [dcl.attr]
+#undef assume // { dg-warning "undefining keyword 'assume'" "" { target c++26 } }
+#undef carries_dependency
+#undef deprecated // { dg-warning "undefining keyword 'deprecated'" "" { target c++26 } }
+#undef fallthrough // { dg-warning "undefining keyword 'fallthrough'" "" { target c++26 } }
+#undef indeterminate
+#undef likely // { dg-warning "undefining keyword 'likely'" "" { target c++26 } }
+#undef maybe_unused // { dg-warning "undefining keyword 'maybe_unused'" "" { target c++26 } }
+#undef nodiscard // { dg-warning "undefining keyword 'nodiscard'" "" { target c++26 } }
+#undef noreturn // { dg-warning "undefining keyword 'noreturn'" "" { target c++26 } }
+#undef no_unique_address // { dg-warning "undefining keyword 'no_unique_address'" "" { target c++26 } }
+#undef unlikely // { dg-warning "undefining keyword 'unlikely'" "" { target c++26 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-6.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-6.C
new file mode 100644
index 0000000..881df8b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-6.C
@@ -0,0 +1,7 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+#include "Wkeyword-macro-4.C"
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-7.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-7.C
new file mode 100644
index 0000000..30a2c8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-7.C
@@ -0,0 +1,112 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+// [lex.key]
+#define alignas 1 // { dg-warning "keyword 'alignas' defined as macro" "" { target c++11 } }
+#define alignof 1 // { dg-warning "keyword 'alignof' defined as macro" "" { target c++11 } }
+#define asm 1 // { dg-warning "keyword 'asm' defined as macro" }
+#define auto 1 // { dg-warning "keyword 'auto' defined as macro" }
+#define bool 1 // { dg-warning "keyword 'bool' defined as macro" }
+#define break 1 // { dg-warning "keyword 'break' defined as macro" }
+#define case 1 // { dg-warning "keyword 'case' defined as macro" }
+#define catch 1 // { dg-warning "keyword 'catch' defined as macro" }
+#define char 1 // { dg-warning "keyword 'char' defined as macro" }
+#define char16_t 1 // { dg-warning "keyword 'char16_t' defined as macro" "" { target c++11 } }
+#define char32_t 1 // { dg-warning "keyword 'char32_t' defined as macro" "" { target c++11 } }
+#define char8_t 1 // { dg-warning "keyword 'char8_t' defined as macro" "" { target c++20 } }
+#define class 1 // { dg-warning "keyword 'class' defined as macro" }
+#define co_await 1 // { dg-warning "keyword 'co_await' defined as macro" "" { target c++20 } }
+#define concept 1 // { dg-warning "keyword 'concept' defined as macro" "" { target c++20 } }
+#define const 1 // { dg-warning "keyword 'const' defined as macro" }
+#define const_cast 1 // { dg-warning "keyword 'const_cast' defined as macro" }
+#define consteval 1 // { dg-warning "keyword 'consteval' defined as macro" "" { target c++20 } }
+#define constexpr 1 // { dg-warning "keyword 'constexpr' defined as macro" "" { target c++11 } }
+#define constinit 1 // { dg-warning "keyword 'constinit' defined as macro" "" { target c++20 } }
+#define continue 1 // { dg-warning "keyword 'continue' defined as macro" }
+#define contract_assert 1
+#define co_return 1 // { dg-warning "keyword 'co_return' defined as macro" "" { target c++20 } }
+#define co_yield 1 // { dg-warning "keyword 'co_yield' defined as macro" "" { target c++20 } }
+#define decltype 1 // { dg-warning "keyword 'decltype' defined as macro" "" { target c++11 } }
+#define default 1 // { dg-warning "keyword 'default' defined as macro" }
+#define delete 1 // { dg-warning "keyword 'delete' defined as macro" }
+#define do 1 // { dg-warning "keyword 'do' defined as macro" }
+#define double 1 // { dg-warning "keyword 'double' defined as macro" }
+#define dynamic_cast 1 // { dg-warning "keyword 'dynamic_cast' defined as macro" }
+#define else 1 // { dg-warning "keyword 'else' defined as macro" }
+#define enum 1 // { dg-warning "keyword 'enum' defined as macro" }
+#define explicit 1 // { dg-warning "keyword 'explicit' defined as macro" }
+#define export 1 // { dg-warning "keyword 'export' defined as macro" }
+#define extern 1 // { dg-warning "keyword 'extern' defined as macro" }
+#define false 1 // { dg-warning "keyword 'false' defined as macro" }
+#define float 1 // { dg-warning "keyword 'float' defined as macro" }
+#define for 1 // { dg-warning "keyword 'for' defined as macro" }
+#define friend 1 // { dg-warning "keyword 'friend' defined as macro" }
+#define goto 1 // { dg-warning "keyword 'goto' defined as macro" }
+#define if 1 // { dg-warning "keyword 'if' defined as macro" }
+#define inline 1 // { dg-warning "keyword 'inline' defined as macro" }
+#define int 1 // { dg-warning "keyword 'int' defined as macro" }
+#define long 1 // { dg-warning "keyword 'long' defined as macro" }
+#define mutable 1 // { dg-warning "keyword 'mutable' defined as macro" }
+#define namespace 1 // { dg-warning "keyword 'namespace' defined as macro" }
+#define new 1 // { dg-warning "keyword 'new' defined as macro" }
+#define noexcept 1 // { dg-warning "keyword 'noexcept' defined as macro" "" { target c++11 } }
+#define nullptr 1 // { dg-warning "keyword 'nullptr' defined as macro" "" { target c++11 } }
+#define operator 1 // { dg-warning "keyword 'operator' defined as macro" }
+#define private 1 // { dg-warning "keyword 'private' defined as macro" }
+#define protected 1 // { dg-warning "keyword 'protected' defined as macro" }
+#define public 1 // { dg-warning "keyword 'public' defined as macro" }
+#define register 1 // { dg-warning "keyword 'register' defined as macro" }
+#define reinterpret_cast 1 // { dg-warning "keyword 'reinterpret_cast' defined as macro" }
+#define requires 1 // { dg-warning "keyword 'requires' defined as macro" "" { target c++20 } }
+#define return 1 // { dg-warning "keyword 'return' defined as macro" }
+#define short 1 // { dg-warning "keyword 'short' defined as macro" }
+#define signed 1 // { dg-warning "keyword 'signed' defined as macro" }
+#define sizeof 1 // { dg-warning "keyword 'sizeof' defined as macro" }
+#define static 1 // { dg-warning "keyword 'static' defined as macro" }
+#define static_assert 1 // { dg-warning "keyword 'static_assert' defined as macro" "" { target c++11 } }
+#define static_cast 1 // { dg-warning "keyword 'static_cast' defined as macro" }
+#define struct 1 // { dg-warning "keyword 'struct' defined as macro" }
+#define switch 1 // { dg-warning "keyword 'switch' defined as macro" }
+#define template 1 // { dg-warning "keyword 'template' defined as macro" }
+#define this 1 // { dg-warning "keyword 'this' defined as macro" }
+#define thread_local 1 // { dg-warning "keyword 'thread_local' defined as macro" "" { target c++11 } }
+#define throw 1 // { dg-warning "keyword 'throw' defined as macro" }
+#define true 1 // { dg-warning "keyword 'true' defined as macro" }
+#define try 1 // { dg-warning "keyword 'try' defined as macro" }
+#define typedef 1 // { dg-warning "keyword 'typedef' defined as macro" }
+#define typeid 1 // { dg-warning "keyword 'typeid' defined as macro" }
+#define typename 1 // { dg-warning "keyword 'typename' defined as macro" }
+#define union 1 // { dg-warning "keyword 'union' defined as macro" }
+#define unsigned 1 // { dg-warning "keyword 'unsigned' defined as macro" }
+#define using 1 // { dg-warning "keyword 'using' defined as macro" }
+#define virtual 1 // { dg-warning "keyword 'virtual' defined as macro" }
+#define void 1 // { dg-warning "keyword 'void' defined as macro" }
+#define volatile 1 // { dg-warning "keyword 'volatile' defined as macro" }
+#define wchar_t 1 // { dg-warning "keyword 'wchar_t' defined as macro" }
+#define while 1 // { dg-warning "keyword 'while' defined as macro" }
+
+// [lex.name]
+#define final 1 // { dg-warning "keyword 'final' defined as macro" "" { target c++11 } }
+#define import 1 // { dg-warning "keyword 'import' defined as macro" "" { target c++20 } }
+#define module 1 // { dg-warning "keyword 'module' defined as macro" "" { target c++20 } }
+#define override 1 // { dg-warning "keyword 'override' defined as macro" "" { target c++11 } }
+#define post 1
+#define pre 1
+#define replaceable_if_eligible 1 // { dg-warning "keyword 'replaceable_if_eligible' defined as macro" "" { target c++26 } }
+#define trivially_relocatable_if_eligible 1 // { dg-warning "keyword 'trivially_relocatable_if_eligible' defined as macro" "" { target c++26 } }
+
+// [dcl.attr]
+#define assume 1 // { dg-warning "keyword 'assume' defined as macro" "" { target c++23 } }
+#define carries_dependency 1 // { dg-warning "keyword 'carries_dependency' defined as macro" "" { target { c++11 && c++23_down } } }
+#define deprecated 1 // { dg-warning "keyword 'deprecated' defined as macro" "" { target c++14 } }
+#define fallthrough 1 // { dg-warning "keyword 'fallthrough' defined as macro" "" { target c++17 } }
+#define indeterminate 1
+#define likely 1 // { dg-warning "keyword 'likely' defined as macro" "" { target c++20 } }
+#define maybe_unused 1 // { dg-warning "keyword 'maybe_unused' defined as macro" "" { target c++17 } }
+#define nodiscard 1 // { dg-warning "keyword 'nodiscard' defined as macro" "" { target c++17 } }
+#define noreturn 1 // { dg-warning "keyword 'noreturn' defined as macro" "" { target c++11 } }
+#define no_unique_address 1 // { dg-warning "keyword 'no_unique_address' defined as macro" "" { target c++20 } }
+#define unlikely 1 // { dg-warning "keyword 'unlikely' defined as macro" "" { target c++20 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-8.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-8.C
new file mode 100644
index 0000000..7dcc377
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-8.C
@@ -0,0 +1,112 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro" }
+// { dg-additional-options "-fmodules" { target c++20 } }
+
+// [lex.key]
+#undef alignas // { dg-warning "undefining keyword 'alignas'" "" { target c++11 } }
+#undef alignof // { dg-warning "undefining keyword 'alignof'" "" { target c++11 } }
+#undef asm // { dg-warning "undefining keyword 'asm'" }
+#undef auto // { dg-warning "undefining keyword 'auto'" }
+#undef bool // { dg-warning "undefining keyword 'bool'" }
+#undef break // { dg-warning "undefining keyword 'break'" }
+#undef case // { dg-warning "undefining keyword 'case'" }
+#undef catch // { dg-warning "undefining keyword 'catch'" }
+#undef char // { dg-warning "undefining keyword 'char'" }
+#undef char16_t // { dg-warning "undefining keyword 'char16_t'" "" { target c++11 } }
+#undef char32_t // { dg-warning "undefining keyword 'char32_t'" "" { target c++11 } }
+#undef char8_t // { dg-warning "undefining keyword 'char8_t'" "" { target c++20 } }
+#undef class // { dg-warning "undefining keyword 'class'" }
+#undef co_await // { dg-warning "undefining keyword 'co_await'" "" { target c++20 } }
+#undef concept // { dg-warning "undefining keyword 'concept'" "" { target c++20 } }
+#undef const // { dg-warning "undefining keyword 'const'" }
+#undef const_cast // { dg-warning "undefining keyword 'const_cast'" }
+#undef consteval // { dg-warning "undefining keyword 'consteval'" "" { target c++20 } }
+#undef constexpr // { dg-warning "undefining keyword 'constexpr'" "" { target c++11 } }
+#undef constinit // { dg-warning "undefining keyword 'constinit'" "" { target c++20 } }
+#undef continue // { dg-warning "undefining keyword 'continue'" }
+#undef contract_assert
+#undef co_return // { dg-warning "undefining keyword 'co_return'" "" { target c++20 } }
+#undef co_yield // { dg-warning "undefining keyword 'co_yield'" "" { target c++20 } }
+#undef decltype // { dg-warning "undefining keyword 'decltype'" "" { target c++11 } }
+#undef default // { dg-warning "undefining keyword 'default'" }
+#undef delete // { dg-warning "undefining keyword 'delete'" }
+#undef do // { dg-warning "undefining keyword 'do'" }
+#undef double // { dg-warning "undefining keyword 'double'" }
+#undef dynamic_cast // { dg-warning "undefining keyword 'dynamic_cast'" }
+#undef else // { dg-warning "undefining keyword 'else'" }
+#undef enum // { dg-warning "undefining keyword 'enum'" }
+#undef explicit // { dg-warning "undefining keyword 'explicit'" }
+#undef export // { dg-warning "undefining keyword 'export'" }
+#undef extern // { dg-warning "undefining keyword 'extern'" }
+#undef false // { dg-warning "undefining keyword 'false'" }
+#undef float // { dg-warning "undefining keyword 'float'" }
+#undef for // { dg-warning "undefining keyword 'for'" }
+#undef friend // { dg-warning "undefining keyword 'friend'" }
+#undef goto // { dg-warning "undefining keyword 'goto'" }
+#undef if // { dg-warning "undefining keyword 'if'" }
+#undef inline // { dg-warning "undefining keyword 'inline'" }
+#undef int // { dg-warning "undefining keyword 'int'" }
+#undef long // { dg-warning "undefining keyword 'long'" }
+#undef mutable // { dg-warning "undefining keyword 'mutable'" }
+#undef namespace // { dg-warning "undefining keyword 'namespace'" }
+#undef new // { dg-warning "undefining keyword 'new'" }
+#undef noexcept // { dg-warning "undefining keyword 'noexcept'" "" { target c++11 } }
+#undef nullptr // { dg-warning "undefining keyword 'nullptr'" "" { target c++11 } }
+#undef operator // { dg-warning "undefining keyword 'operator'" }
+#undef private // { dg-warning "undefining keyword 'private'" }
+#undef protected // { dg-warning "undefining keyword 'protected'" }
+#undef public // { dg-warning "undefining keyword 'public'" }
+#undef register // { dg-warning "undefining keyword 'register'" }
+#undef reinterpret_cast // { dg-warning "undefining keyword 'reinterpret_cast'" }
+#undef requires // { dg-warning "undefining keyword 'requires'" "" { target c++20 } }
+#undef return // { dg-warning "undefining keyword 'return'" }
+#undef short // { dg-warning "undefining keyword 'short'" }
+#undef signed // { dg-warning "undefining keyword 'signed'" }
+#undef sizeof // { dg-warning "undefining keyword 'sizeof'" }
+#undef static // { dg-warning "undefining keyword 'static'" }
+#undef static_assert // { dg-warning "undefining keyword 'static_assert'" "" { target c++11 } }
+#undef static_cast // { dg-warning "undefining keyword 'static_cast'" }
+#undef struct // { dg-warning "undefining keyword 'struct'" }
+#undef switch // { dg-warning "undefining keyword 'switch'" }
+#undef template // { dg-warning "undefining keyword 'template'" }
+#undef this // { dg-warning "undefining keyword 'this'" }
+#undef thread_local // { dg-warning "undefining keyword 'thread_local'" "" { target c++11 } }
+#undef throw // { dg-warning "undefining keyword 'throw'" }
+#undef true // { dg-warning "undefining keyword 'true'" }
+#undef try // { dg-warning "undefining keyword 'try'" }
+#undef typedef // { dg-warning "undefining keyword 'typedef'" }
+#undef typeid // { dg-warning "undefining keyword 'typeid'" }
+#undef typename // { dg-warning "undefining keyword 'typename'" }
+#undef union // { dg-warning "undefining keyword 'union'" }
+#undef unsigned // { dg-warning "undefining keyword 'unsigned'" }
+#undef using // { dg-warning "undefining keyword 'using'" }
+#undef virtual // { dg-warning "undefining keyword 'virtual'" }
+#undef void // { dg-warning "undefining keyword 'void'" }
+#undef volatile // { dg-warning "undefining keyword 'volatile'" }
+#undef wchar_t // { dg-warning "undefining keyword 'wchar_t'" }
+#undef while // { dg-warning "undefining keyword 'while'" }
+
+// [lex.name]
+#undef final // { dg-warning "undefining keyword 'final'" "" { target c++11 } }
+#undef import // { dg-warning "undefining keyword 'import'" "" { target c++20 } }
+#undef module // { dg-warning "undefining keyword 'module'" "" { target c++20 } }
+#undef override // { dg-warning "undefining keyword 'override'" "" { target c++11 } }
+#undef post
+#undef pre
+#undef replaceable_if_eligible // { dg-warning "undefining keyword 'replaceable_if_eligible'" "" { target c++26 } }
+#undef trivially_relocatable_if_eligible // { dg-warning "undefining keyword 'trivially_relocatable_if_eligible'" "" { target c++26 } }
+
+// [dcl.attr]
+#undef assume // { dg-warning "undefining keyword 'assume'" "" { target c++23 } }
+#undef carries_dependency // { dg-warning "undefining keyword 'carries_dependency'" "" { target { c++11 && c++23_down } } }
+#undef deprecated // { dg-warning "undefining keyword 'deprecated'" "" { target c++14 } }
+#undef fallthrough // { dg-warning "undefining keyword 'fallthrough'" "" { target c++17 } }
+#undef indeterminate
+#undef likely // { dg-warning "undefining keyword 'likely'" "" { target c++20 } }
+#undef maybe_unused // { dg-warning "undefining keyword 'maybe_unused'" "" { target c++17 } }
+#undef nodiscard // { dg-warning "undefining keyword 'nodiscard'" "" { target c++17 } }
+#undef noreturn // { dg-warning "undefining keyword 'noreturn'" "" { target c++11 } }
+#undef no_unique_address // { dg-warning "undefining keyword 'no_unique_address'" "" { target c++20 } }
+#undef unlikely // { dg-warning "undefining keyword 'unlikely'" "" { target c++20 } }
diff --git a/gcc/testsuite/g++.dg/warn/Wkeyword-macro-9.C b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-9.C
new file mode 100644
index 0000000..741cdee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wkeyword-macro-9.C
@@ -0,0 +1,22 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// [cpp.replace.general]/9
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#undef for // { dg-error "undefining keyword 'for'" "" { target c++26 } }
+#define for for // { dg-error "keyword 'for' defined as macro" "" { target c++26 } }
+#undef for // { dg-error "undefining keyword 'for'" "" { target c++26 } }
+#define while do // { dg-error "keyword 'while' defined as macro" "" { target c++26 } }
+#define while do // { dg-error "keyword 'while' defined as macro" "" { target c++26 } }
+#define while for // { dg-error "keyword 'while' defined as macro" "" { target c++26 } }
+ // { dg-error "'while' redefined" "" { target *-*-* } .-1 }
+#undef while // { dg-error "undefining keyword 'while'" "" { target c++26 } }
+#define while while // { dg-error "keyword 'while' defined as macro" "" { target c++26 } }
+#define private public // { dg-error "keyword 'private' defined as macro" "" { target c++26 } }
+#define inline // { dg-error "keyword 'inline' defined as macro" "" { target c++26 } }
+#undef inline // { dg-error "undefining keyword 'inline'" "" { target c++26 } }
+#define inline __inline__ __attribute__((__always_inline__)) // { dg-error "keyword 'inline' defined as macro" "" { target c++26 } }
+#define likely(a) a
+#undef likely // { dg-error "undefining keyword 'likely'" "" { target c++26 } }
+#define unlikely(a, b, c) a + b + c
+#define unlikely(a, b, c) a + b + c
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr121449.C b/gcc/testsuite/g++.target/aarch64/sve/pr121449.C
new file mode 100644
index 0000000..b2e1376
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr121449.C
@@ -0,0 +1,44 @@
+/* PR target/121449 */
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O3 -save-temps" } */
+
+struct example;
+
+struct array {
+ unsigned length();
+ example *operator[](unsigned i) {
+ example **data = reinterpret_cast<example **>(this);
+ return data[i];
+ }
+};
+
+struct example {
+ int a[16];
+ bool is_even;
+ int version;
+ int count() { return is_even ? 2 : 1; }
+ void fun1(int, long);
+ void fun2(unsigned, unsigned);
+ void process(array &, array &);
+};
+
+bool found;
+
+void example::process(array &a, array &b) {
+ for (unsigned i = 1; a.length(); i++) {
+ long total = 0;
+ for (unsigned k = 0; k <= i; k++) {
+ total += a[k]->count();
+ }
+ for (unsigned j = 0; j < i; j++) {
+ int major = b[j]->version;
+ if (found)
+ major += i;
+ fun1(i + 1, total);
+ fun2(j, major);
+ }
+ }
+}
+
+/* { dg-final { scan-assembler-not {\tld1b\t(z[0-9]+)\.d, p[0-7]/z, \[(z[0-9]+)\.d, #64\]} } } */
+
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-1.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-1.c
new file mode 100644
index 0000000..0b2d78f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-1.c
@@ -0,0 +1,62 @@
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro -std=c23" }
+
+#define _Alignas 1 // { dg-warning "keyword '_Alignas' defined as macro" }
+#define _Alignof 1 // { dg-warning "keyword '_Alignof' defined as macro" }
+#define _Atomic 1 // { dg-warning "keyword '_Atomic' defined as macro" }
+#define _BitInt 1 // { dg-warning "keyword '_BitInt' defined as macro" }
+#define _Bool 1 // { dg-warning "keyword '_Bool' defined as macro" }
+#define _Complex 1 // { dg-warning "keyword '_Complex' defined as macro" }
+#define _Decimal128 1 // { dg-warning "keyword '_Decimal128' defined as macro" }
+#define _Decimal32 1 // { dg-warning "keyword '_Decimal32' defined as macro" }
+#define _Decimal64 1 // { dg-warning "keyword '_Decimal64' defined as macro" }
+#define _Generic 1 // { dg-warning "keyword '_Generic' defined as macro" }
+#define _Imaginary 1 // { dg-warning "keyword '_Imaginary' defined as macro" }
+#define _Noreturn 1 // { dg-warning "keyword '_Noreturn' defined as macro" }
+#define _Static_assert 1 // { dg-warning "keyword '_Static_assert' defined as macro" }
+#define _Thread_local 1 // { dg-warning "keyword '_Thread_local' defined as macro" }
+#define alignas 1 // { dg-warning "keyword 'alignas' defined as macro" }
+#define alignof 1 // { dg-warning "keyword 'alignof' defined as macro" }
+#define auto 1 // { dg-warning "keyword 'auto' defined as macro" }
+#define bool 1 // { dg-warning "keyword 'bool' defined as macro" }
+#define break 1 // { dg-warning "keyword 'break' defined as macro" }
+#define case 1 // { dg-warning "keyword 'case' defined as macro" }
+#define char 1 // { dg-warning "keyword 'char' defined as macro" }
+#define const 1 // { dg-warning "keyword 'const' defined as macro" }
+#define constexpr 1 // { dg-warning "keyword 'constexpr' defined as macro" }
+#define continue 1 // { dg-warning "keyword 'continue' defined as macro" }
+#define default 1 // { dg-warning "keyword 'default' defined as macro" }
+#define do 1 // { dg-warning "keyword 'do' defined as macro" }
+#define double 1 // { dg-warning "keyword 'double' defined as macro" }
+#define else 1 // { dg-warning "keyword 'else' defined as macro" }
+#define enum 1 // { dg-warning "keyword 'enum' defined as macro" }
+#define extern 1 // { dg-warning "keyword 'extern' defined as macro" }
+#define false 1 // { dg-warning "keyword 'false' defined as macro" }
+#define float 1 // { dg-warning "keyword 'float' defined as macro" }
+#define for 1 // { dg-warning "keyword 'for' defined as macro" }
+#define goto 1 // { dg-warning "keyword 'goto' defined as macro" }
+#define if 1 // { dg-warning "keyword 'if' defined as macro" }
+#define inline 1 // { dg-warning "keyword 'inline' defined as macro" }
+#define int 1 // { dg-warning "keyword 'int' defined as macro" }
+#define long 1 // { dg-warning "keyword 'long' defined as macro" }
+#define nullptr 1 // { dg-warning "keyword 'nullptr' defined as macro" }
+#define register 1 // { dg-warning "keyword 'register' defined as macro" }
+#define restrict 1 // { dg-warning "keyword 'restrict' defined as macro" }
+#define return 1 // { dg-warning "keyword 'return' defined as macro" }
+#define short 1 // { dg-warning "keyword 'short' defined as macro" }
+#define signed 1 // { dg-warning "keyword 'signed' defined as macro" }
+#define sizeof 1 // { dg-warning "keyword 'sizeof' defined as macro" }
+#define static 1 // { dg-warning "keyword 'static' defined as macro" }
+#define static_assert 1 // { dg-warning "keyword 'static_assert' defined as macro" }
+#define struct 1 // { dg-warning "keyword 'struct' defined as macro" }
+#define switch 1 // { dg-warning "keyword 'switch' defined as macro" }
+#define thread_local 1 // { dg-warning "keyword 'thread_local' defined as macro" }
+#define true 1 // { dg-warning "keyword 'true' defined as macro" }
+#define typedef 1 // { dg-warning "keyword 'typedef' defined as macro" }
+#define typeof 1 // { dg-warning "keyword 'typeof' defined as macro" }
+#define typeof_unqual 1 // { dg-warning "keyword 'typeof_unqual' defined as macro" }
+#define union 1 // { dg-warning "keyword 'union' defined as macro" }
+#define unsigned 1 // { dg-warning "keyword 'unsigned' defined as macro" }
+#define void 1 // { dg-warning "keyword 'void' defined as macro" }
+#define volatile 1 // { dg-warning "keyword 'volatile' defined as macro" }
+#define while 1 // { dg-warning "keyword 'while' defined as macro" }
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-2.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-2.c
new file mode 100644
index 0000000..329a55a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-2.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=c23" }
+
+#include "Wkeyword-macro-1.c"
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-3.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-3.c
new file mode 100644
index 0000000..f631b8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-3.c
@@ -0,0 +1,62 @@
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro -std=c23" }
+
+#undef _Alignas // { dg-warning "undefining keyword '_Alignas'" }
+#undef _Alignof // { dg-warning "undefining keyword '_Alignof'" }
+#undef _Atomic // { dg-warning "undefining keyword '_Atomic'" }
+#undef _BitInt // { dg-warning "undefining keyword '_BitInt'" }
+#undef _Bool // { dg-warning "undefining keyword '_Bool'" }
+#undef _Complex // { dg-warning "undefining keyword '_Complex'" }
+#undef _Decimal128 // { dg-warning "undefining keyword '_Decimal128'" }
+#undef _Decimal32 // { dg-warning "undefining keyword '_Decimal32'" }
+#undef _Decimal64 // { dg-warning "undefining keyword '_Decimal64'" }
+#undef _Generic // { dg-warning "undefining keyword '_Generic'" }
+#undef _Imaginary // { dg-warning "undefining keyword '_Imaginary'" }
+#undef _Noreturn // { dg-warning "undefining keyword '_Noreturn'" }
+#undef _Static_assert // { dg-warning "undefining keyword '_Static_assert'" }
+#undef _Thread_local // { dg-warning "undefining keyword '_Thread_local'" }
+#undef alignas // { dg-warning "undefining keyword 'alignas'" }
+#undef alignof // { dg-warning "undefining keyword 'alignof'" }
+#undef auto // { dg-warning "undefining keyword 'auto'" }
+#undef bool // { dg-warning "undefining keyword 'bool'" }
+#undef break // { dg-warning "undefining keyword 'break'" }
+#undef case // { dg-warning "undefining keyword 'case'" }
+#undef char // { dg-warning "undefining keyword 'char'" }
+#undef const // { dg-warning "undefining keyword 'const'" }
+#undef constexpr // { dg-warning "undefining keyword 'constexpr'" }
+#undef continue // { dg-warning "undefining keyword 'continue'" }
+#undef default // { dg-warning "undefining keyword 'default'" }
+#undef do // { dg-warning "undefining keyword 'do'" }
+#undef double // { dg-warning "undefining keyword 'double'" }
+#undef else // { dg-warning "undefining keyword 'else'" }
+#undef enum // { dg-warning "undefining keyword 'enum'" }
+#undef extern // { dg-warning "undefining keyword 'extern'" }
+#undef false // { dg-warning "undefining keyword 'false'" }
+#undef float // { dg-warning "undefining keyword 'float'" }
+#undef for // { dg-warning "undefining keyword 'for'" }
+#undef goto // { dg-warning "undefining keyword 'goto'" }
+#undef if // { dg-warning "undefining keyword 'if'" }
+#undef inline // { dg-warning "undefining keyword 'inline'" }
+#undef int // { dg-warning "undefining keyword 'int'" }
+#undef long // { dg-warning "undefining keyword 'long'" }
+#undef nullptr // { dg-warning "undefining keyword 'nullptr'" }
+#undef register // { dg-warning "undefining keyword 'register'" }
+#undef restrict // { dg-warning "undefining keyword 'restrict'" }
+#undef return // { dg-warning "undefining keyword 'return'" }
+#undef short // { dg-warning "undefining keyword 'short'" }
+#undef signed // { dg-warning "undefining keyword 'signed'" }
+#undef sizeof // { dg-warning "undefining keyword 'sizeof'" }
+#undef static // { dg-warning "undefining keyword 'static'" }
+#undef static_assert // { dg-warning "undefining keyword 'static_assert'" }
+#undef struct // { dg-warning "undefining keyword 'struct'" }
+#undef switch // { dg-warning "undefining keyword 'switch'" }
+#undef thread_local // { dg-warning "undefining keyword 'thread_local'" }
+#undef true // { dg-warning "undefining keyword 'true'" }
+#undef typedef // { dg-warning "undefining keyword 'typedef'" }
+#undef typeof // { dg-warning "undefining keyword 'typeof'" }
+#undef typeof_unqual // { dg-warning "undefining keyword 'typeof_unqual'" }
+#undef union // { dg-warning "undefining keyword 'union'" }
+#undef unsigned // { dg-warning "undefining keyword 'unsigned'" }
+#undef void // { dg-warning "undefining keyword 'void'" }
+#undef volatile // { dg-warning "undefining keyword 'volatile'" }
+#undef while // { dg-warning "undefining keyword 'while'" }
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-4.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-4.c
new file mode 100644
index 0000000..796d654
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-4.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=c23" }
+
+#include "Wkeyword-macro-3.c"
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-5.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-5.c
new file mode 100644
index 0000000..c61a1ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-5.c
@@ -0,0 +1,47 @@
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro -std=c17" }
+
+#define _Alignas 1 // { dg-warning "keyword '_Alignas' defined as macro" }
+#define _Alignof 1 // { dg-warning "keyword '_Alignof' defined as macro" }
+#define _Atomic 1 // { dg-warning "keyword '_Atomic' defined as macro" }
+#define _Bool 1 // { dg-warning "keyword '_Bool' defined as macro" }
+#define _Complex 1 // { dg-warning "keyword '_Complex' defined as macro" }
+#define _Generic 1 // { dg-warning "keyword '_Generic' defined as macro" }
+#define _Imaginary 1 // { dg-warning "keyword '_Imaginary' defined as macro" }
+#define _Noreturn 1 // { dg-warning "keyword '_Noreturn' defined as macro" }
+#define _Static_assert 1 // { dg-warning "keyword '_Static_assert' defined as macro" }
+#define _Thread_local 1 // { dg-warning "keyword '_Thread_local' defined as macro" }
+#define auto 1 // { dg-warning "keyword 'auto' defined as macro" }
+#define break 1 // { dg-warning "keyword 'break' defined as macro" }
+#define case 1 // { dg-warning "keyword 'case' defined as macro" }
+#define char 1 // { dg-warning "keyword 'char' defined as macro" }
+#define const 1 // { dg-warning "keyword 'const' defined as macro" }
+#define continue 1 // { dg-warning "keyword 'continue' defined as macro" }
+#define default 1 // { dg-warning "keyword 'default' defined as macro" }
+#define do 1 // { dg-warning "keyword 'do' defined as macro" }
+#define double 1 // { dg-warning "keyword 'double' defined as macro" }
+#define else 1 // { dg-warning "keyword 'else' defined as macro" }
+#define enum 1 // { dg-warning "keyword 'enum' defined as macro" }
+#define extern 1 // { dg-warning "keyword 'extern' defined as macro" }
+#define float 1 // { dg-warning "keyword 'float' defined as macro" }
+#define for 1 // { dg-warning "keyword 'for' defined as macro" }
+#define goto 1 // { dg-warning "keyword 'goto' defined as macro" }
+#define if 1 // { dg-warning "keyword 'if' defined as macro" }
+#define inline 1 // { dg-warning "keyword 'inline' defined as macro" }
+#define int 1 // { dg-warning "keyword 'int' defined as macro" }
+#define long 1 // { dg-warning "keyword 'long' defined as macro" }
+#define register 1 // { dg-warning "keyword 'register' defined as macro" }
+#define restrict 1 // { dg-warning "keyword 'restrict' defined as macro" }
+#define return 1 // { dg-warning "keyword 'return' defined as macro" }
+#define short 1 // { dg-warning "keyword 'short' defined as macro" }
+#define signed 1 // { dg-warning "keyword 'signed' defined as macro" }
+#define sizeof 1 // { dg-warning "keyword 'sizeof' defined as macro" }
+#define static 1 // { dg-warning "keyword 'static' defined as macro" }
+#define struct 1 // { dg-warning "keyword 'struct' defined as macro" }
+#define switch 1 // { dg-warning "keyword 'switch' defined as macro" }
+#define typedef 1 // { dg-warning "keyword 'typedef' defined as macro" }
+#define union 1 // { dg-warning "keyword 'union' defined as macro" }
+#define unsigned 1 // { dg-warning "keyword 'unsigned' defined as macro" }
+#define void 1 // { dg-warning "keyword 'void' defined as macro" }
+#define volatile 1 // { dg-warning "keyword 'volatile' defined as macro" }
+#define while 1 // { dg-warning "keyword 'while' defined as macro" }
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-6.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-6.c
new file mode 100644
index 0000000..760ece6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-6.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=c17" }
+
+#include "Wkeyword-macro-5.c"
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-7.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-7.c
new file mode 100644
index 0000000..dc146d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-7.c
@@ -0,0 +1,47 @@
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro -std=c17" }
+
+#undef _Alignas // { dg-warning "undefining keyword '_Alignas'" }
+#undef _Alignof // { dg-warning "undefining keyword '_Alignof'" }
+#undef _Atomic // { dg-warning "undefining keyword '_Atomic'" }
+#undef _Bool // { dg-warning "undefining keyword '_Bool'" }
+#undef _Complex // { dg-warning "undefining keyword '_Complex'" }
+#undef _Generic // { dg-warning "undefining keyword '_Generic'" }
+#undef _Imaginary // { dg-warning "undefining keyword '_Imaginary'" }
+#undef _Noreturn // { dg-warning "undefining keyword '_Noreturn'" }
+#undef _Static_assert // { dg-warning "undefining keyword '_Static_assert'" }
+#undef _Thread_local // { dg-warning "undefining keyword '_Thread_local'" }
+#undef auto // { dg-warning "undefining keyword 'auto'" }
+#undef break // { dg-warning "undefining keyword 'break'" }
+#undef case // { dg-warning "undefining keyword 'case'" }
+#undef char // { dg-warning "undefining keyword 'char'" }
+#undef const // { dg-warning "undefining keyword 'const'" }
+#undef continue // { dg-warning "undefining keyword 'continue'" }
+#undef default // { dg-warning "undefining keyword 'default'" }
+#undef do // { dg-warning "undefining keyword 'do'" }
+#undef double // { dg-warning "undefining keyword 'double'" }
+#undef else // { dg-warning "undefining keyword 'else'" }
+#undef enum // { dg-warning "undefining keyword 'enum'" }
+#undef extern // { dg-warning "undefining keyword 'extern'" }
+#undef float // { dg-warning "undefining keyword 'float'" }
+#undef for // { dg-warning "undefining keyword 'for'" }
+#undef goto // { dg-warning "undefining keyword 'goto'" }
+#undef if // { dg-warning "undefining keyword 'if'" }
+#undef inline // { dg-warning "undefining keyword 'inline'" }
+#undef int // { dg-warning "undefining keyword 'int'" }
+#undef long // { dg-warning "undefining keyword 'long'" }
+#undef register // { dg-warning "undefining keyword 'register'" }
+#undef restrict // { dg-warning "undefining keyword 'restrict'" }
+#undef return // { dg-warning "undefining keyword 'return'" }
+#undef short // { dg-warning "undefining keyword 'short'" }
+#undef signed // { dg-warning "undefining keyword 'signed'" }
+#undef sizeof // { dg-warning "undefining keyword 'sizeof'" }
+#undef static // { dg-warning "undefining keyword 'static'" }
+#undef struct // { dg-warning "undefining keyword 'struct'" }
+#undef switch // { dg-warning "undefining keyword 'switch'" }
+#undef typedef // { dg-warning "undefining keyword 'typedef'" }
+#undef union // { dg-warning "undefining keyword 'union'" }
+#undef unsigned // { dg-warning "undefining keyword 'unsigned'" }
+#undef void // { dg-warning "undefining keyword 'void'" }
+#undef volatile // { dg-warning "undefining keyword 'volatile'" }
+#undef while // { dg-warning "undefining keyword 'while'" }
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-8.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-8.c
new file mode 100644
index 0000000..b209f40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-8.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=c17" }
+
+#include "Wkeyword-macro-7.c"
diff --git a/gcc/testsuite/gcc.dg/Wkeyword-macro-9.c b/gcc/testsuite/gcc.dg/Wkeyword-macro-9.c
new file mode 100644
index 0000000..5d6b650
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wkeyword-macro-9.c
@@ -0,0 +1,15 @@
+// { dg-do preprocess }
+// { dg-options "-Wkeyword-macro" }
+
+#undef for // { dg-warning "undefining keyword 'for'" }
+#define for for // { dg-warning "keyword 'for' defined as macro" }
+#undef for // { dg-warning "undefining keyword 'for'" }
+#define while do // { dg-warning "keyword 'while' defined as macro" }
+#define while do // { dg-warning "keyword 'while' defined as macro" }
+#define while for // { dg-warning "keyword 'while' defined as macro" }
+ // { dg-warning "'while' redefined" "" { target *-*-* } .-1 }
+#undef while // { dg-warning "undefining keyword 'while'" }
+#define while while // { dg-warning "keyword 'while' defined as macro" }
+#define inline // { dg-warning "keyword 'inline' defined as macro" }
+#undef inline // { dg-warning "undefining keyword 'inline'" }
+#define inline __inline__ __attribute__((__always_inline__)) // { dg-warning "keyword 'inline' defined as macro" }
diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-1.c b/gcc/testsuite/gcc.dg/asm-hard-reg-1.c
index 6a5a9ad..8cefb6e 100644
--- a/gcc/testsuite/gcc.dg/asm-hard-reg-1.c
+++ b/gcc/testsuite/gcc.dg/asm-hard-reg-1.c
@@ -22,10 +22,11 @@
/* { dg-final { scan-assembler-times "foo\t%r4" 8 { target { s390*-*-* } } } } */
#elif defined (__x86_64__)
# define GPR "{rcx}"
-/* { dg-final { scan-assembler-times "foo\t%cl" 2 { target { x86_64-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%cx" 2 { target { x86_64-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%ecx" 2 { target { x86_64-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%rcx" 2 { target { x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t%cl" 2 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t%cx" 2 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t%ecx" 2 { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */
+/* { dg-final { scan-assembler-times "foo\t%rcx" 2 { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */
+/* { dg-final { scan-assembler-times "foo\t%ecx" 4 { target { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } */
#endif
char
diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-2.c b/gcc/testsuite/gcc.dg/asm-hard-reg-2.c
index 7dabf96..5a60f9b 100644
--- a/gcc/testsuite/gcc.dg/asm-hard-reg-2.c
+++ b/gcc/testsuite/gcc.dg/asm-hard-reg-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target aarch64*-*-* powerpc64*-*-* riscv64-*-* s390*-*-* x86_64-*-* } } */
+/* { dg-do compile { target { { aarch64*-*-* powerpc64*-*-* riscv64-*-* s390*-*-* } || { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } } */
/* { dg-options "-std=c99" } we need long long */
#if defined (__aarch64__)
@@ -15,7 +15,7 @@
/* { dg-final { scan-assembler-times "foo\t%r4" 2 { target { s390*-*-* } } } } */
#elif defined (__x86_64__)
# define GPR "{rcx}"
-/* { dg-final { scan-assembler-times "foo\t%rcx" 2 { target { x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t%rcx" 2 { target { i?86-*-* x86_64-*-* } } } } */
#endif
long long
diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-4.c b/gcc/testsuite/gcc.dg/asm-hard-reg-4.c
index 0134bf0..d319467 100644
--- a/gcc/testsuite/gcc.dg/asm-hard-reg-4.c
+++ b/gcc/testsuite/gcc.dg/asm-hard-reg-4.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target aarch64*-*-* arm*-*-* powerpc*-*-* riscv*-*-* s390*-*-* x86_64-*-* } } */
+/* { dg-do compile { target aarch64*-*-* arm*-*-* i?86-*-* powerpc*-*-* riscv*-*-* s390*-*-* x86_64-*-* } } */
+/* { dg-additional-options "-msse2" { target i?86-*-* x86_64-*-* } } */
#if defined (__aarch64__)
# define FPR "{d5}"
@@ -16,9 +17,9 @@
#elif defined (__s390__)
# define FPR "{f5}"
/* { dg-final { scan-assembler-times "foo\t%f5" 4 { target { s390*-*-* } } } } */
-#elif defined (__x86_64__)
+#elif defined (__i386__) || defined (__x86_64__)
# define FPR "{xmm5}"
-/* { dg-final { scan-assembler-times "foo\t%xmm5" 4 { target { x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t%xmm5" 4 { target { i?86-*-* x86_64-*-* } } } } */
#endif
float
diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-5.c b/gcc/testsuite/gcc.dg/asm-hard-reg-5.c
index a9e25ce..ea7907a 100644
--- a/gcc/testsuite/gcc.dg/asm-hard-reg-5.c
+++ b/gcc/testsuite/gcc.dg/asm-hard-reg-5.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target aarch64*-*-* powerpc64*-*-* riscv64-*-* s390*-*-* x86_64-*-* } } */
+/* { dg-do compile { target { { aarch64*-*-* powerpc64*-*-* riscv64-*-* s390*-*-* } || { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } } */
typedef int V __attribute__ ((vector_size (4 * sizeof (int))));
diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-6.c b/gcc/testsuite/gcc.dg/asm-hard-reg-6.c
index d9b7fae..c87a811 100644
--- a/gcc/testsuite/gcc.dg/asm-hard-reg-6.c
+++ b/gcc/testsuite/gcc.dg/asm-hard-reg-6.c
@@ -19,8 +19,8 @@
# define GPR1 "{eax}"
# define GPR2 "{ebx}"
# define GPR3 "{ecx}"
-/* { dg-final { scan-assembler-times "foo\t4\\(%esp\\),%ecx" 1 { target { i?86-*-* } } } } */
-/* { dg-final { scan-assembler-times "bar\t%ebx,\\(%eax\\)" 1 { target { i?86-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t4\\(%esp\\),%ecx" 1 { target { { i?86-*-* x86_64-*-* } && { ia32 } } } } } */
+/* { dg-final { scan-assembler-times "bar\t%ebx,\\(%eax\\)" 1 { target { { i?86-*-* x86_64-*-* } && { ia32 } } } } } */
#elif defined (__powerpc__) || defined (__POWERPC__)
# define GPR1 "{r4}"
# define GPR2 "{r5}"
@@ -43,8 +43,10 @@
# define GPR1 "{eax}"
# define GPR2 "{ebx}"
# define GPR3 "{rcx}"
-/* { dg-final { scan-assembler-times "foo\t%eax,%rcx" 1 { target { x86_64-*-* } } } } */
-/* { dg-final { scan-assembler-times "bar\t%ebx,\\(%rsi\\)" 1 { target { x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "foo\t%eax,%rcx" 1 { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */
+/* { dg-final { scan-assembler-times "bar\t%ebx,\\(%rsi\\)" 1 { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */
+/* { dg-final { scan-assembler-times "foo\t%eax,%ecx" 1 { target { { i?86-*-* x86_64-*-* } && x32 } } } } */
+/* { dg-final { scan-assembler-times "bar\t%ebx,\\(%esi\\)" 1 { target { { i?86-*-* x86_64-*-* } && x32 } } } } */
#endif
void
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c
new file mode 100644
index 0000000..3492899
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-diagnostics-show-nesting" } */
+
+extern void foo (void);
+
+void test_nesting (void)
+{
+ foo (); /* { dg-error "top-level error" } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c
new file mode 100644
index 0000000..8fc2edb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fdiagnostics-show-nesting" } */
+
+extern void foo (void);
+
+void test_nesting (void)
+{
+ foo (); /* { dg-error "top-level error" } */
+}
+
+/* { dg-begin-multiline-output "" }
+ * child 0
+ * grandchild 0 0
+ * grandchild 0 1
+ * grandchild 0 2
+ * child 1
+ * grandchild 1 0
+ * grandchild 1 1
+ * grandchild 1 2
+ * child 2
+ * grandchild 2 0
+ * grandchild 2 1
+ * grandchild 2 2
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c
index f44c8eb..4be52fe 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-levels=yes" } */
+/* { dg-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-levels=yes" } */
extern void foo (void);
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c
index 39e29f7..c069c3f 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-set-output=text:experimental-nesting=yes -fdiagnostics-text-art-charset=unicode" } */
+/* { dg-options "-fdiagnostics-set-output=text:show-nesting=yes -fdiagnostics-text-art-charset=unicode" } */
extern void foo (void);
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c
index e103429..a35254d 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-set-output=text:experimental-nesting=yes" } */
+/* { dg-options "-fdiagnostics-set-output=text:show-nesting=yes" } */
extern void foo (void);
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
index 3bb6063..c7cc36c 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -112,6 +112,8 @@ set plugin_test_list [list \
diagnostic-test-graphs-html.c \
diagnostic-test-graphs-sarif.c } \
{ diagnostic_plugin_test_nesting.cc \
+ diagnostic-test-nesting-show-nesting.c \
+ diagnostic-test-nesting-no-show-nesting.c \
diagnostic-test-nesting-text-plain.c \
diagnostic-test-nesting-text-indented.c \
diagnostic-test-nesting-text-indented-show-levels.c \
diff --git a/gcc/testsuite/gcc.dg/pr118946-1.c b/gcc/testsuite/gcc.dg/pr118946-1.c
new file mode 100644
index 0000000..6cf2661
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr118946-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-forwprop1-details" } */
+
+/* PR tree-optimization/118946 */
+
+void f(char *a)
+{
+ char t[1024] = {};
+ __builtin_memcpy(a, t, 10);
+}
+
+/* We should be able to optimize the memcpy into a memset here. */
+/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1"} } */
+/* { dg-final { scan-tree-dump-times "memset " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "memcpy " "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/hardbool-ai.c b/gcc/testsuite/gcc.dg/torture/hardbool-ai.c
index 97569a6..af4e0e1 100644
--- a/gcc/testsuite/gcc.dg/torture/hardbool-ai.c
+++ b/gcc/testsuite/gcc.dg/torture/hardbool-ai.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require-effective-target sync_int_long } */
#define basetype _Atomic int
diff --git a/gcc/testsuite/gcc.dg/torture/pr121422-1.c b/gcc/testsuite/gcc.dg/torture/pr121422-1.c
new file mode 100644
index 0000000..136f80d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr121422-1.c
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+/* PR tree-optimization/121422 */
+
+struct s1
+{
+ char a[4];
+};
+struct s1 b;
+char t[4];
+
+/* if both t and b startout zero initialized before this function,
+ t should end up being:
+ {0, 0, 1, 0}
+ while b.a should end up being:
+ {0, 0, 0, 1}
+*/
+__attribute__((noipa,noinline))
+void f(void)
+{
+ b = (struct s1){};
+ b.a[3] = 1;
+ /* This memcpy should stay a memcpy and not become memset. */
+ __builtin_memcpy(&t[0], &b.a[1], 3*sizeof(t[0]));
+}
+
+
+int main()
+{
+ f();
+ for(int i = 0; i < 4; i++)
+ {
+ if (t[i] != (i == 2 ? 1 : 0))
+ __builtin_abort();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr121422-2.c b/gcc/testsuite/gcc.dg/torture/pr121422-2.c
new file mode 100644
index 0000000..570559c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr121422-2.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* PR tree-optimization/121422 */
+
+struct s1
+{
+ char a[4];
+};
+struct s1 b;
+char t[4];
+
+/* if both t and b startout zero initialized before this function,
+ t should end up being:
+ {0, 0, 1, 0}
+ while b.a should end up being:
+ {0, 0, 0, 1}
+*/
+__attribute__((noipa,noinline))
+void f(void)
+{
+ __builtin_memset(&b.a[1], 0, 2);
+ b.a[3] = 1;
+ /* This memcpy should stay a memcpy and not become memset. */
+ __builtin_memcpy(&t[0], &b.a[1], 3);
+}
+
+
+int main()
+{
+ f();
+ for(int i = 0; i < 4; i++)
+ {
+ if (t[i] != (i == 2 ? 1 : 0))
+ __builtin_abort();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-107.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-107.c
new file mode 100644
index 0000000..f80baf3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-107.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+struct vec_char_16
+{
+ unsigned char raw[2];
+};
+
+static inline struct vec_char_16
+Dup128VecFromValues(unsigned char t0, unsigned char t1)
+{
+ struct vec_char_16 result;
+ result.raw[0] = t0;
+ result.raw[1] = t1;
+ return result;
+}
+
+int f(unsigned char t0, unsigned char t1)
+{
+ struct vec_char_16 a = Dup128VecFromValues(t0, t1);
+ struct vec_char_16 b;
+ __builtin_memcpy(&b, &a, sizeof(a));
+ return b.raw[0] + b.raw[1];
+}
+
+/* Ideally we'd optimize this at FRE1 time but we only replace
+ the loads from b.raw[] with BIT_FIELD_REFs which get optimized
+ only later in the next FRE. */
+/* { dg-final { scan-tree-dump-not "MEM" "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr120986-1.c b/gcc/testsuite/gcc.target/aarch64/pr120986-1.c
new file mode 100644
index 0000000..e3bc56c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr120986-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv8.2-a+sve2+fp8dot2" } */
+#include <arm_sve.h>
+
+/* This triggered an ICE with an unrecognizable insn due to incorrect gating of
+ the insn in the backend. */
+svfloat16_t foo(svfloat16_t a, svmfloat8_t b, svmfloat8_t c, unsigned long fpm)
+{
+ return svdot_lane_fpm (a, b, c, 0, fpm);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sme/pr121414_1.c b/gcc/testsuite/gcc.target/aarch64/sme/pr121414_1.c
new file mode 100644
index 0000000..ad8600f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sme/pr121414_1.c
@@ -0,0 +1,27 @@
+#pragma GCC target "+sme2"
+
+void f1() __arm_streaming_compatible {}
+void f2() __arm_streaming {}
+void f3() __arm_in("za") {}
+void f4() __arm_out("za") {}
+void f5() __arm_inout("za") {}
+void f6() __arm_in("zt0") {}
+void f7() __arm_out("zt0") {}
+void f8() __arm_inout("zt0") {}
+
+__arm_locally_streaming void g1() {}
+__arm_new("za") void g2() {}
+__arm_new("zt0") void g3() {}
+
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf1\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf2\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf3\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf4\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf5\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf6\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf7\n} } } */
+/* { dg-final { scan-assembler {\t\.variant_pcs\tf8\n} } } */
+
+/* { dg-final { scan-assembler-not {\t\.variant_pcs\tg1\n} } } */
+/* { dg-final { scan-assembler-not {\t\.variant_pcs\tg2\n} } } */
+/* { dg-final { scan-assembler-not {\t\.variant_pcs\tg3\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c
new file mode 100644
index 0000000..9ca0938
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c
@@ -0,0 +1,12 @@
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+typedef int __attribute__((vector_size(8))) v2si;
+typedef struct { int x; int y; } A;
+void bar(A a);
+void foo()
+{
+ A a;
+ *(v2si *)&a = (v2si){0, (int)svcntd_pat(SV_ALL)};
+ bar(a);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11.c
new file mode 100644
index 0000000..feb7ee7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11.c
@@ -0,0 +1,20 @@
+/* Peeling for alignment with masking in VLA modes. */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -msve-vector-bits=scalable --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */
+
+#define START 3
+#define END 510
+
+int __attribute__((noipa))
+foo (int *a) {
+ for (signed int i = START; i < END; ++i) {
+ if (a[i] != 0)
+ return i;
+ }
+ return -1;
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */
+/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */
+/* { dg-final { scan-assembler {\tnot\tp[0-7]\.b, p[0-7]/z, p.*\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11_run.c
new file mode 100644
index 0000000..b4c267f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_11_run.c
@@ -0,0 +1,27 @@
+/* Peeling for alignment with masking in VLA modes. */
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-Ofast -msve-vector-bits=scalable --param aarch64-autovec-preference=sve-only" } */
+
+#include "peel_ind_11.c"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define N 512
+
+int __attribute__ ((optimize (1)))
+main (void)
+{
+ for (int k = 5; k < 30; k++) {
+ int *a = (int *) malloc (sizeof(int) * N);
+
+ /* Set only one non-zero element for test. */
+ for (int i = 5; i < 30; i++)
+ a[i] = (i == k ? 1 : 0);
+
+ int res = foo (a);
+ asm volatile ("");
+ if (res != k) {
+ __builtin_abort ();
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12.c
new file mode 100644
index 0000000..260482a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12.c
@@ -0,0 +1,21 @@
+/* Peeling for alignment with masking together with versioning in VLA modes. */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -msve-vector-bits=scalable --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */
+
+#define START 5
+#define END 509
+
+int __attribute__((noipa))
+foo (int *restrict a, int * restrict b) {
+ for (signed int i = START; i < END; ++i) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */
+/* { dg-final { scan-tree-dump "Both peeling and versioning will be applied" "vect" } } */
+/* { dg-final { scan-assembler {\tnot\tp[0-7]\.b, p[0-7]/z, p.*\n} } } */
+/* { dg-final { scan-assembler {\teor\t.*\n} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12_run.c
new file mode 100644
index 0000000..ba978fe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_12_run.c
@@ -0,0 +1,29 @@
+/* Peeling for alignment with masking together with versioning in VLA modes. */
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-Ofast -msve-vector-bits=scalable --param aarch64-autovec-preference=sve-only" } */
+
+#include "peel_ind_12.c"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define N 512
+
+int __attribute__ ((optimize (1)))
+main (void) {
+ for (int k = 5; k < 50; k++) {
+ int *a = (int *) malloc (sizeof(int) * N);
+ int *b = (int *) malloc (sizeof(int) * N);
+
+ /* Set only one place of different values for test. */
+ for (int i = 5; i < 50; i++) {
+ a[i] = (i == k ? 1 : 0);
+ b[i] = 0;
+ }
+
+ int res = foo (a, b);
+ asm volatile ("");
+ if (res != k) {
+ __builtin_abort ();
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13.c
new file mode 100644
index 0000000..730e33e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13.c
@@ -0,0 +1,24 @@
+/* Known inbounds DR in VLA modes. */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -msve-vector-bits=scalable --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */
+
+#define N 512
+#define START 5
+#define END 509
+
+int x[N] __attribute__((aligned(32)));
+
+int __attribute__((noipa))
+foo (void)
+{
+ for (signed int i = START; i < END; ++i)
+ {
+ if (x[i] == 0)
+ return i;
+ }
+ return -1;
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump-not "pfa_iv_offset" "vect" } } */
+/* { dg-final { scan-tree-dump-not "Alignment of access forced using peeling" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13_run.c
new file mode 100644
index 0000000..83352a8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_13_run.c
@@ -0,0 +1,15 @@
+/* Known inbounds DR in VLA modes. */
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-Ofast -msve-vector-bits=scalable --param aarch64-autovec-preference=sve-only" } */
+
+#include "peel_ind_13.c"
+
+int __attribute__ ((optimize (1)))
+main (void)
+{
+ int res = foo ();
+ asm volatile ("");
+ if (res != START)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/torture/pr120986-2.c b/gcc/testsuite/gcc.target/aarch64/torture/pr120986-2.c
new file mode 100644
index 0000000..1218dea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/torture/pr120986-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv8.2-a+sve2+fp8dot2" } */
+#include <arm_sve.h>
+svfloat16_t foo(svfloat16_t a, svmfloat8_t b, svmfloat8_t c)
+{
+ return svdot_lane_fpm (a, b, c, 0, 0);
+}
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c
index db7d975..eb8a358 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-mcmse -fdump-rtl-final-slim" } */
+/* Make sure FPCXT is not enabled. */
+/* { dg-options "-mcmse -fdump-rtl-final -march=armv8-m.main+fp" } */
typedef void (*f)(int) __attribute__((cmse_nonsecure_call));
@@ -8,5 +9,5 @@ void bar(f func, int a)
func(a);
}
-/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" { target { ! arm_v8_1m_mve_ok } } } } */
-/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r\[0-7\]:SI\\\]\\\]" "final" { target { arm_v8_1m_mve_ok } } } } */
+/* { dg-final { scan-rtl-dump "call \\\(mem:SI \\\(reg:SI 4 r4" "final" } } */
+/* { dg-final { scan-rtl-dump "UNSPEC_NONSECURE_MEM" "final" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-19.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-19.c
new file mode 100644
index 0000000..ae075c3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-19.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* This is a duplicate of cmse-18.c, targetting arm_v8_1m_mve, to make sure
+ FPCXT is enabled. */
+/* { dg-options "-mcmse -fdump-rtl-final -march=armv8.1-m.main+mve" } */
+
+typedef void (*f)(int) __attribute__((cmse_nonsecure_call));
+
+void bar(f func, int a)
+{
+ func(a);
+}
+
+/* { dg-final { scan-rtl-dump "call \\\(mem:SI \\\(reg/f:SI \[0-7] r\[0-7\]" "final" } } */
+/* { dg-final { scan-rtl-dump "UNSPEC_NONSECURE_MEM" "final" } } */
diff --git a/gcc/testsuite/gcc.target/i386/asm-hard-reg-2.c b/gcc/testsuite/gcc.target/i386/asm-hard-reg-2.c
index b35cf53..756f6f8 100644
--- a/gcc/testsuite/gcc.target/i386/asm-hard-reg-2.c
+++ b/gcc/testsuite/gcc.target/i386/asm-hard-reg-2.c
@@ -8,7 +8,7 @@ test (void)
#ifdef __x86_64__
int z __attribute__ ((mode (TI)));
#else
- long z;
+ long long z;
#endif
__asm__ __volatile__ ("" : "=A" (z), "={rbx}" (y));
diff --git a/gcc/testsuite/gcc.target/i386/pr90579.c b/gcc/testsuite/gcc.target/i386/pr90579.c
index ab48a44..e8c6bad3 100644
--- a/gcc/testsuite/gcc.target/i386/pr90579.c
+++ b/gcc/testsuite/gcc.target/i386/pr90579.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mavx2 -mfpmath=sse" } */
+/* { dg-options "-O3 -mavx2 -mfpmath=sse -fno-pie" } */
extern double r[6];
extern double a[];
@@ -16,8 +16,5 @@ loop (int k, double x)
return t;
}
-/* Verify we end up with scalar loads from r for the final sum. */
-/* { dg-final { scan-assembler "vaddsd\tr\\\+40" } } */
-/* { dg-final { scan-assembler "vaddsd\tr\\\+32" } } */
-/* { dg-final { scan-assembler "vaddsd\tr\\\+24" } } */
-/* { dg-final { scan-assembler "vaddsd\tr\\\+16" } } */
+/* Verify we end up with no loads from r. */
+/* { dg-final { scan-assembler-not "v\[ma\]\[^\t \]+\tr" } } */
diff --git a/gcc/testsuite/gcc.target/s390/bitint-1.c b/gcc/testsuite/gcc.target/s390/bitint-1.c
new file mode 100644
index 0000000..8bdf2ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/bitint-1.c
@@ -0,0 +1,83 @@
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-O2 -march=z9-109" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+/* Verify calling convention. */
+
+static_assert (sizeof (_BitInt(5)) == 1);
+static_assert (sizeof (_BitInt(9)) == 2);
+static_assert (sizeof (_BitInt(17)) == 4);
+static_assert (sizeof (_BitInt(33)) == 8);
+
+/*
+** bitint5_zero_extend_call:
+** lghi %r2,22
+** jg bitint5_zero_extend@PLT
+*/
+
+void bitint5_zero_extend (unsigned _BitInt(5) x);
+void bitint5_zero_extend_call (void) { bitint5_zero_extend (22wbu); }
+
+/*
+** bitint5_sign_extend_call:
+** lghi %r2,-10
+** jg bitint5_sign_extend@PLT
+*/
+
+void bitint5_sign_extend (_BitInt(5) x);
+void bitint5_sign_extend_call (void) { bitint5_sign_extend (-10wb); }
+
+/*
+** bitint9_zero_extend_call:
+** lghi %r2,422
+** jg bitint9_zero_extend@PLT
+*/
+
+void bitint9_zero_extend (unsigned _BitInt(9) x);
+void bitint9_zero_extend_call (void) { bitint9_zero_extend (422wbu); }
+
+/*
+** bitint9_sign_extend_call:
+** lghi %r2,-90
+** jg bitint9_sign_extend@PLT
+*/
+
+void bitint9_sign_extend (_BitInt(9) x);
+void bitint9_sign_extend_call (void) { bitint9_sign_extend (-90wb); }
+
+/*
+** bitint17_zero_extend_call:
+** lgfi %r2,108198
+** jg bitint17_zero_extend@PLT
+*/
+
+void bitint17_zero_extend (unsigned _BitInt(17) x);
+void bitint17_zero_extend_call (void) { bitint17_zero_extend (108198wbu); }
+
+/*
+** bitint17_sign_extend_call:
+** lghi %r2,-22874
+** jg bitint17_sign_extend@PLT
+*/
+
+void bitint17_sign_extend (_BitInt(17) x);
+void bitint17_sign_extend_call (void) { bitint17_sign_extend (-22874wb); }
+
+/*
+** bitint33_zero_extend_call:
+** llihl %r2,1
+** oilf %r2,2795939494
+** jg bitint33_zero_extend@PLT
+*/
+
+void bitint33_zero_extend (unsigned _BitInt(33) x);
+void bitint33_zero_extend_call (void) { bitint33_zero_extend (7090906790wbu); }
+
+/*
+** bitint33_sign_extend_call:
+** lgfi %r2,-1499027802
+** jg bitint33_sign_extend@PLT
+*/
+
+void bitint33_sign_extend (_BitInt(33) x);
+void bitint33_sign_extend_call (void) { bitint33_sign_extend (-1499027802wb); }
diff --git a/gcc/testsuite/gcc.target/s390/bitint-2.c b/gcc/testsuite/gcc.target/s390/bitint-2.c
new file mode 100644
index 0000000..9b0e6b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/bitint-2.c
@@ -0,0 +1,32 @@
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23" } */
+
+/* Verify calling convention. */
+
+static_assert (sizeof (_BitInt(65)) == 16);
+
+[[gnu::noipa]] void
+bitint65_zero_extend (unsigned _BitInt(65) x)
+{
+ static const char y[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0xBA, 0xDC, 0x0F, 0xFE, 0xE0, 0xDD, 0xF0, 0x0D};
+ if (__builtin_memcmp (&x, y, 16) != 0)
+ __builtin_abort ();
+}
+
+[[gnu::noipa]] void
+bitint65_sign_extend (signed _BitInt(65) x)
+{
+ static const char y[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xBA, 0xDC, 0x0F, 0xFE, 0xE0, 0xDD, 0xF0, 0x0D};
+ if (__builtin_memcmp (&x, y, 16) != 0)
+ __builtin_abort ();
+}
+
+int
+main (void)
+{
+ bitint65_zero_extend (0x1BADC0FFEE0DDF00Dwbu);
+ bitint65_sign_extend (0x1BADC0FFEE0DDF00Dwb);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/s390/bitint-3.c b/gcc/testsuite/gcc.target/s390/bitint-3.c
new file mode 100644
index 0000000..9132028
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/bitint-3.c
@@ -0,0 +1,28 @@
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-march=z9-109 -fdump-rtl-expand" } */
+
+/* Verify calling convention. */
+
+/* { dg-final { scan-rtl-dump-times "zero_extend:DI.*reg:QI" 1 "expand" } } */
+void bitint5_zero_extend (unsigned _BitInt(5) x);
+void bitint5_zero_extend_call (unsigned _BitInt(5) x) { bitint5_zero_extend (x + 1); }
+
+/* { dg-final { scan-rtl-dump-times "sign_extend:DI.*reg:QI" 1 "expand" } } */
+void bitint5_sign_extend (_BitInt(5) x);
+void bitint5_sign_extend_call (_BitInt(5) x) { bitint5_sign_extend (x + 1); }
+
+/* { dg-final { scan-rtl-dump-times "zero_extend:DI.*reg:HI" 1 "expand" } } */
+void bitint9_zero_extend (unsigned _BitInt(9) x);
+void bitint9_zero_extend_call (unsigned _BitInt(9) x) { bitint9_zero_extend (x + 1); }
+
+/* { dg-final { scan-rtl-dump-times "sign_extend:DI.*reg:HI" 1 "expand" } } */
+void bitint9_sign_extend (_BitInt(9) x);
+void bitint9_sign_extend_call (_BitInt(9) x) { bitint9_sign_extend (x + 1); }
+
+/* { dg-final { scan-rtl-dump-times "zero_extend:DI.*reg:SI" 1 "expand" } } */
+void bitint17_zero_extend (unsigned _BitInt(17) x);
+void bitint17_zero_extend_call (unsigned _BitInt(17) x) { bitint17_zero_extend (x + 1); }
+
+/* { dg-final { scan-rtl-dump-times "sign_extend:DI.*reg:SI" 1 "expand" } } */
+void bitint17_sign_extend (_BitInt(17) x);
+void bitint17_sign_extend_call (_BitInt(17) x) { bitint17_sign_extend (x + 1); }
diff --git a/gcc/testsuite/gcc.target/s390/bitint-4.c b/gcc/testsuite/gcc.target/s390/bitint-4.c
new file mode 100644
index 0000000..dce72d8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/bitint-4.c
@@ -0,0 +1,71 @@
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-march=z9-109 -O2" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+/* Verify calling convention. */
+
+struct s_bitint5 {
+ short a;
+ unsigned _BitInt(5) b;
+ char c;
+};
+
+static_assert (sizeof (struct s_bitint5) == 4);
+
+/*
+** s_bitint5_call:
+** iilf %r2,2758168
+** jg s_bitint5@PLT
+*/
+
+void s_bitint5 (struct s_bitint5 x);
+void s_bitint5_call (void) { s_bitint5 ((struct s_bitint5){42, 22wbu, 24}); }
+
+struct s_bitint9 {
+ short a;
+ unsigned _BitInt(9) b;
+};
+
+static_assert (sizeof (struct s_bitint9) == 4);
+
+/*
+** s_bitint9_call:
+** iilf %r2,2752934
+** jg s_bitint9@PLT
+*/
+
+void s_bitint9 (struct s_bitint9 x);
+void s_bitint9_call (void) { s_bitint9 ((struct s_bitint9){42, 422wbu}); }
+
+struct s_bitint17 {
+ int a;
+ unsigned _BitInt(17) b;
+};
+
+static_assert (sizeof (struct s_bitint17) == 8);
+
+/*
+** s_bitint17_call:
+** llihl %r2,42
+** oilf %r2,108198
+** jg s_bitint17@PLT
+*/
+
+void s_bitint17 (struct s_bitint17 x);
+void s_bitint17_call (void) { s_bitint17 ((struct s_bitint17){42, 108198wbu}); }
+
+struct s_bitint33 {
+ unsigned _BitInt(33) b;
+};
+
+static_assert (sizeof (struct s_bitint33) == 8);
+
+/*
+** s_bitint33_call:
+** llihl %r2,1
+** oilf %r2,2795939494
+** jg s_bitint33@PLT
+*/
+
+void s_bitint33 (struct s_bitint33 x);
+void s_bitint33_call (void) { s_bitint33 ((struct s_bitint33){7090906790wbu}); }
diff --git a/gcc/testsuite/gfortran.dg/generic_stmt_1.f90 b/gcc/testsuite/gfortran.dg/generic_stmt_1.f90
new file mode 100644
index 0000000..57d0aba
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_stmt_1.f90
@@ -0,0 +1,194 @@
+! { dg-do run }
+!
+! Test the F2018 generic statement
+!
+function cg (arg1, arg2)
+ complex :: cg
+ complex, intent(in) :: arg1, arg2
+ cg = arg1 + arg2
+end
+
+module m
+ implicit none
+
+ type :: t
+ integer :: i
+ end type
+ integer :: tsum = 0
+
+ public g
+ interface g ! Check generic statement + generic interface works
+ module procedure tg
+ end interface g
+
+ generic :: g => ig, rg
+ generic :: operator(.plus.) => ig, rg
+ generic, private :: h => ig, rg
+ generic :: WRITE(FORMATTED) => wtarray
+
+ interface g ! Check generic statement + generic interface works
+ function cg (arg1, arg2)
+ complex :: cg
+ complex, intent(in) :: arg1, arg2
+ end
+ end interface g
+
+! Subroutines
+ generic, public :: sg => sig, srg
+
+! Check that we can mix with submodule procedures
+ interface
+ real module function realg (arg1, arg2)
+ real, intent(in) :: arg1, arg2
+ end function
+ end interface
+ generic, public :: subg => ig, realg
+
+contains
+
+ function rg (arg1, arg2)
+ real :: rg
+ real, intent(in) :: arg1, arg2
+ rg = arg1 + arg2
+ end
+ function ig (arg1, arg2)
+ integer :: ig
+ integer, intent(in) :: arg1, arg2
+ ig = arg1 + arg2
+ end
+ function tg (arg1, arg2) result(res)
+ type(t) :: res
+ type(t), intent(in) :: arg1, arg2
+ res%i = arg1%i + arg2%i
+ end
+ subroutine srg (arg1, arg2, arg3)
+ real :: arg3
+ real, intent(in) :: arg1, arg2
+ arg3 = arg1 + arg2
+ end
+ subroutine sig (arg1, arg2, arg3)
+ integer :: arg3
+ integer, intent(in) :: arg1, arg2
+ arg3 = arg1 + arg2
+ end
+
+ SUBROUTINE wtarray (dtv, unit, iotype, v_list, iostat, iomsg)
+ CLASS(t), INTENT(IN) :: dtv
+ INTEGER, INTENT(IN) :: unit
+ CHARACTER(*), INTENT(IN) :: iotype
+ INTEGER, INTENT(IN) :: v_list (:)
+ INTEGER, INTENT(OUT) :: iostat
+ CHARACTER(*), INTENT(INOUT) :: iomsg
+ WRITE (unit, FMT=*, iostat=iostat, iomsg=iomsg) dtv%i
+ END SUBROUTINE wtarray
+
+ subroutine foo
+ real :: a = 1.0, b = 2.0, r
+ integer :: c = 3, d = 4
+ type(t) :: tres
+ generic :: operator(+) => tg
+! private in foo
+ r = h(a,b)
+ if (r /= rg(a,b)) stop 1
+ if (h(c,d) /= ig(c,d)) stop 2
+! operator in foo
+ r = a.plus.b
+ if (r /= rg(a,b)) stop 3
+ if ((c.plus.(2*d)) /= ig(c,2*d)) stop 4
+! check intrinsic operator
+ tres = t(21) + t(21)
+ if (tres%i /= 42) stop 5
+ end
+end module m
+
+submodule (m) subm
+contains
+ real module function realg (arg1, arg2)
+ real, intent(in) :: arg1, arg2
+ realg = arg1 + arg2
+ end
+end
+
+program p
+ use m
+ implicit none
+ integer :: i, rv
+
+ generic :: operator(.minus.) => pig, prg
+ generic :: operator(*) => times
+ generic :: j => ig, rg
+ generic :: j => mg
+
+ real :: a = 1.0, b = 2.0, s3
+ integer :: c = 3, d = 4, si
+ type(t) :: t1 = t(2), t2 = t(3), tres
+ type(t) :: tarray(5) = [t(5), t(4), t(3), t(2), t(1)]
+
+! module generic in p
+ if (g(2.0*a,2.0*b) /= rg(2.0*a,2.0*b)) stop 6
+ if (g(c,d) /= ig(c,d)) stop 7
+! local generic in p
+ if (j(a,b) /= rg(a,b)) stop 8
+ if (j(c,d) /= ig (c,d)) stop 9
+! local generic in p with different number of arguments
+ if (j(c,d,-1) /= mg(c,d,-1)) stop 10
+! module operator in p
+ if (7*int(a.plus.b) /= 3*(c.plus.d)) stop 11
+! local operator in p
+ if ((a.minus.b) /= prg(a,b)) stop 12
+ if ((c.minus.d) /= pig(c,d)) stop 13
+! local operator in block
+ block
+ generic :: operator(.bminus.) => pig, prg
+ if ((a.bminus.b) /= prg(a,b)) stop 14
+ if ((c.bminus.d) /= pig(c,d)) stop 15
+ end block
+! intrinsic operator in p
+ tres = t1 * t2
+ if (tres%i /= 6) stop 16
+! test private interface in module
+ call foo
+! test mixture of GENERIC statement and generic INTERFACE
+ if (g((1.0,1.0),(2.0,2.0)) /= cg((1.0,1.0),(2.0,2.0))) stop 17
+ tres = g(t1,t2)
+ if (tres%i /= 5) stop 18
+! subroutines
+ call sg(10.0*a, b, s3)
+ if (int(s3) /= 12) stop 19
+ call sg(5*c, d, si)
+ if (si /= 19) stop 20
+! submodule procedures
+ if (subg(20.0*a,2.0*b) /= realg(20.0*a,2.0*b)) stop 21
+! check DTIO
+ open (10,status='scratch')
+ WRITE(10, '(DT)') tarray
+ rewind(10)
+ do i = 1,5
+ read(10, *) rv
+ tsum = tsum + rv
+ end do
+ close(10)
+ if (tsum /= 15) stop 22
+contains
+
+ function pig (arg1, arg2)
+ integer :: pig
+ integer, intent(in) :: arg1, arg2
+ pig = arg1 - arg2
+ end
+ function prg (arg1, arg2)
+ real :: prg
+ real, intent(in) :: arg1, arg2
+ prg = arg1 - arg2
+ end
+ function times (arg1, arg2) result(res)
+ type(t) :: res
+ type(t), intent(in) :: arg1, arg2
+ res%i = arg1%i * arg2%i
+ end
+ function mg (arg1, arg2, arg3)
+ integer :: mg
+ integer, intent(in) :: arg1, arg2, arg3
+ mg = arg1 - arg2 * arg3
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/generic_stmt_2.f90 b/gcc/testsuite/gfortran.dg/generic_stmt_2.f90
new file mode 100644
index 0000000..f698012
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_stmt_2.f90
@@ -0,0 +1,87 @@
+! { dg-do compile }
+!
+! Test the F2018 generic statement error reporting using the module from
+! generic_stmt_1.f90
+!
+function cg (arg1, arg2)
+ complex :: cg
+ complex, intent(in) :: arg1, arg2
+ cg = arg1 + arg2
+end
+
+module m1
+ implicit none
+
+ type :: t
+ integer :: i
+ end type
+
+ public g
+ interface g ! Check generic statement + generic interface works
+ module procedure tg
+ end interface g
+
+ generic, public :: g => ig ! { dg-error "repeats that already given" }
+ generic, private :: g => rg ! { dg-error "conflicts with that already" }
+ generic :: operator(.plus.) => ig, rg, gg ! { dg-error "did you mean|must be a FUNCTION" }
+ generic, private :: h => ig, rg
+ generic :: => ig, rg ! { dg-error "Malformed GENERIC statement" }
+ generic :: wron ng => ig, rg ! { dg-error "Expected .=>." }
+ generic :: #!& => ig, rg ! { dg-error "Malformed GENERIC statement" }
+ generic, private :: operator(.plusplus.) => ig
+ generic, private :: operator(.plusplus.) => rg ! { dg-error "repeats the access specification" }
+ generic, PUBLIC :: operator(.plusplus.) => tg ! { dg-error "must have the same access" }
+
+ interface g ! Check generic statement + generic interface works
+ function cg (arg1, arg2)
+ complex :: cg
+ complex, intent(in) :: arg1, arg2
+ end
+ end interface g
+
+ generic, public :: sg => sig, srg
+ generic, public :: sg2 => sig, srg, rg ! Error appears at 'srg' declaration
+
+
+contains
+
+ function rg (arg1, arg2)
+ real :: rg
+ real, intent(in) :: arg1, arg2
+ rg = arg1 + arg2
+ end
+ function ig (arg1, arg2)
+ integer :: ig
+ integer, intent(in) :: arg1, arg2
+ ig = arg1 + arg2
+ end
+ function tg (arg1, arg2) result(res)
+ type(t) :: res
+ type(t), intent(in) :: arg1, arg2
+ res%i = arg1%i + arg2%i
+ end
+ subroutine srg (arg1, arg2, arg3) ! { dg-error "procedures must be either all SUBROUTINEs" }
+ real :: arg3
+ real, intent(in) :: arg1, arg2
+ arg3 = arg1 + arg2
+ end
+ subroutine sig (arg1, arg2, arg3)
+ integer :: arg3
+ integer, intent(in) :: arg1, arg2
+ arg3 = arg1 + arg2
+ end
+ subroutine foo
+ real :: a = 1.0, b = 2.0, r
+ integer :: c = 3, d = 4
+ generic, public :: sg => sig, srg ! { dg-error "not in a module" }
+ generic :: operator(+) => rg ! { dg-error "conflicts with intrinsic interface" }
+ r = h(a,d) ! { dg-error "There is no specific function" }
+ if (r /= rg(a,b)) stop 1
+ if (h(c,d) /= ig(c,d)) stop 2
+ generic :: wrong => ig, rg ! { dg-error "Unexpected GENERIC statement" }
+! operator in foo
+ r = c.plus.b ! { dg-error "Unknown operator" }
+ if (r /= rg(a,b)) stop 3
+ if ((c.plus.(2*d)) /= ig(c,2*d)) stop 4
+ end
+end module m1
diff --git a/gcc/testsuite/gfortran.dg/generic_stmt_3.f90 b/gcc/testsuite/gfortran.dg/generic_stmt_3.f90
new file mode 100644
index 0000000..543c63f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_stmt_3.f90
@@ -0,0 +1,96 @@
+! { dg-do compile }
+!
+! Test the F2018 generic statement error reporting of access and name conflicts.
+!
+! Contributed by Steven Kargl <kargls@comcast.net>
+!
+ module foo1
+
+ implicit none
+ private
+
+ public bah
+ generic :: bah => bah, bak ! { dg-error "conflicts with that" }
+
+ public bar
+ generic :: bar => bah, bak ! OK - checked that 'bar' is not a procedure
+
+ contains
+ integer function bah(i)
+ integer, intent(in) :: i
+ bah = i
+ end function bah
+ real function bak(x)
+ real, intent(in) :: x
+ bak = 42.5
+ end function bak
+ end module foo1
+
+ module foo2
+
+ implicit none
+ private
+
+ generic :: bah => bah, bak ! { dg-error "conflicts with that" }
+ public bah
+
+ generic :: bar => bah, bak ! OK - checked that 'bar' is not a procedure
+ public bar
+
+ contains
+ integer function bah(i)
+ integer, intent(in) :: i
+ bah = i
+ end function bah
+ real function bak(x)
+ real, intent(in) :: x
+ bak = 42.5
+ end function bak
+ end module foo2
+
+ module foo3 ! { dg-error "clashes with the name of an entity" }
+
+ implicit none
+ private
+
+ integer :: bar = 10 ! { dg-error "has a type" }
+ generic :: bar => bah, bak ! { dg-error "has a type" }
+
+ generic :: foo3 => bah, bak ! { dg-error "clashes with the name of an entity" }
+
+ contains
+ integer function bah(i)
+ integer, intent(in) :: i
+ bah = i
+ end function bah
+ real function bak(x)
+ real, intent(in) :: x
+ bak = 42.5
+ end function bak
+ end module foo3
+
+ module foo4
+ implicit none
+ private
+ public bak
+
+ generic :: bak => bar, bah
+
+ contains
+ function bar(i)
+ real bar
+ integer, intent(in) :: i
+ bar = i
+ end function bar
+ function bah(x)
+ real bah
+ real, intent(in) :: x
+ bah = x
+ end function bah
+ end module foo4
+
+ program snooze
+ use foo4
+ print *, bak(42) ! Public statement for 'bak' exposes the
+ print *, bak(43.5) ! specific procedures 'bar' and 'bah' here.
+ end program snooze
diff --git a/gcc/testsuite/gfortran.dg/generic_stmt_4.f90 b/gcc/testsuite/gfortran.dg/generic_stmt_4.f90
new file mode 100644
index 0000000..24e814a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_stmt_4.f90
@@ -0,0 +1,43 @@
+! { dg-do run }
+!
+! Test the correct processing of public generic statements and verify that they
+! behave in the same way as public interfaces.
+!
+! Contributed by Steven Kargl <kargls@comcast.net>
+!
+module foo
+
+ implicit none
+
+ private
+ public bak1, bak2
+
+
+ generic :: bak1 => bar, bah
+
+ ! Should be equivalent to above.
+
+ interface bak2
+ module procedure bar
+ module procedure bah
+ end interface bak2
+
+
+ contains
+ function bar(i)
+ real bar
+ integer, intent(in) :: i
+ bar = i
+ end function bar
+ function bah(x)
+ real bah
+ real, intent(in) :: x
+ bah = x
+ end function bah
+end module foo
+
+program snooze
+ use foo
+ if (bak1(42) /= bak2(42)) stop 1
+ if (bak1(43.5) /= bak2(43.5)) stop 2
+end program snooze
diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index 08fd969..6865047 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -153,6 +153,9 @@ proc handle-multiline-outputs { text } {
# If dg-enable-nn-line-numbers was provided, then obscure source-margin
# line numbers by converting them to "NN" form.
set text [maybe-handle-nn-line-numbers $text]
+
+ # Remove Windows .exe suffix
+ regsub -all "(as|cc1|cc1plus|collect2|f951|ld|lto-wrapper)\.exe?:" $text {\1:} text
set index 0
foreach entry $multiline_expected_outputs {