diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-01-15 18:27:07 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-01-15 18:28:33 +0100 |
commit | 2619413a5e032e2f2c3d4a2202ba8bf324cf08ab (patch) | |
tree | 5794e70200244ad9c37f70741ab23467e2042e97 /gcc/testsuite/g++.dg/cpp0x | |
parent | 4ce502f31f95ec19e7d347d43afcd015895f135d (diff) | |
download | gcc-2619413a5e032e2f2c3d4a2202ba8bf324cf08ab.zip gcc-2619413a5e032e2f2c3d4a2202ba8bf324cf08ab.tar.gz gcc-2619413a5e032e2f2c3d4a2202ba8bf324cf08ab.tar.bz2 |
c++: Handle RAW_DATA_CST in unify [PR118390]
This patch uses the count_ctor_elements function to fix up
unify deduction of array sizes.
2025-01-15 Jakub Jelinek <jakub@redhat.com>
PR c++/118390
* cp-tree.h (count_ctor_elements): Declare.
* call.cc (count_ctor_elements): No longer static.
* pt.cc (unify): Use count_ctor_elements instead of
CONSTRUCTOR_NELTS.
* g++.dg/cpp/embed-20.C: New test.
* g++.dg/cpp0x/pr118390.C: New test.
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr118390.C | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr118390.C b/gcc/testsuite/g++.dg/cpp0x/pr118390.C new file mode 100644 index 0000000..e5017b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr118390.C @@ -0,0 +1,23 @@ +// PR c++/118390 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +template<typename T, int N> +constexpr int +foo (const T (&x)[N]) +{ + return N; +} + +static_assert (foo ({ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, +}) == 160, ""); |