On 5/11/26 12:11 PM, Jason Merrill wrote:
On 5/11/26 4:26 AM, Torbjorn SVENSSON wrote:
Hi,
In r16-8662-g2cdd7831e31601, a new test was added that experience the
same kind of issue that was addressed in this patch.
The following snippet allows the new test to work the same way as for
the other 2 tests:
diff --git a/gcc/testsuite/g++.dg/reflect/reflect_constant_array11.C
b/ gcc/testsuite/g++.dg/reflect/reflect_constant_array11.C
index 044a2a0d2a6..b3e01f911ec 100644
--- a/gcc/testsuite/g++.dg/reflect/reflect_constant_array11.C
+++ b/gcc/testsuite/g++.dg/reflect/reflect_constant_array11.C
@@ -11,7 +11,7 @@ using namespace std::meta;
struct A { int a, b; mutable int c; };
constexpr A aa[2] = { { 1, 2, 3 }, { 4, 5, 6 } };
constexpr auto a = reflect_constant_array (aa);
-// { dg-error "'reflect_constant_array' argument with
'std::ranges::range_value_t<const A \\\[2\\\]>' \\\{aka 'A'\\\} which
is not a structural type" "" { target *-*-* } .-1 }
+// { dg-error "'reflect_constant_array' argument with
'std::ranges::range_value_t<const A \\\[2\\\]>' \\\{aka '(A|
std::iter_value_t<const A\\\*>)'\\\} which is not a structural type"
"" { target *-*-* } .-1 }
struct B { constexpr B (int x, int y) : a (x), b (y) {} constexpr ~B
() {} B (const B &) = delete; int a, b; };
constexpr B b[2][2] = { { { 1, 2 }, { 2, 3 } }, { { 3, 4 }, { 4,
5 } } };
constexpr auto c = reflect_constant_array (b);
Is this a feasible route to go or is there some work to be done in the
compiler to avoid the 2 different error messages?
Does this (untested) patch help?
We can test this by running the test with -D_GLIBCXX_SYSHDR to simulate
installed conditions, and it seems to work for me. I'll continue with
this direction.
Jason