Hi!

I forgot about PR112652 and added a test that relies on iconv actually
failing when converting from UTF-8 with some emojis to a character set
without those characters.
Seems Solaris iconv just transcodes such characters as ? instead of
reporting an error.

The following patch splits the test into two halves, so that the first one
is tested on Solaris, and uses dg-skip-if for Solaris like in r16-6209
in the second half (rather than expecting no diagnostics for Solaris,
because one can use GNU libiconv on Solaris too).

Tested on x86_64-linux, ok for trunk?

2026-03-11  Jakub Jelinek  <[email protected]>

        PR c++/124118
        * g++.dg/reflect/eh8.C (bar, c): Move second part of tests to ...
        * g++.dg/reflect/eh10.C: ... here, new test.  Add dg-skip-if for
        solaris.

--- gcc/testsuite/g++.dg/reflect/eh8.C.jj       2026-03-11 07:55:50.743792844 
+0100
+++ gcc/testsuite/g++.dg/reflect/eh8.C  2026-03-11 09:58:57.599351534 +0100
@@ -19,13 +19,4 @@ foo ()
   return true;
 }
 
-consteval bool
-bar ()
-{
-  exception a (u8"\N{GRINNING FACE}\N{GRINNING FACE WITH SMILING EYES}\N{LEFT 
SPEECH BUBBLE}", ^^foo);
-  const char *b = a.what ();   // { dg-message "in 'constexpr' expansion of 
'a.std::meta::exception::what\\\(\\\)" }
-  return true;                 // { dg-error "constexpr message: 
std::meta::exception message could not be successfully transcoded from UTF-8 to 
ordinary literal encoding" "" { target *-*-* } 0 }
-}
-
 static_assert (foo ());
-constexpr auto c = bar ();
--- gcc/testsuite/g++.dg/reflect/eh10.C.jj      2026-03-11 09:58:38.711670749 
+0100
+++ gcc/testsuite/g++.dg/reflect/eh10.C 2026-03-11 10:06:02.522170045 +0100
@@ -0,0 +1,19 @@
+// { dg-do compile { target c++26 } }
+// { dg-require-iconv "ISO-8859-2" }
+// { dg-options "-freflection -fexec-charset=ISO-8859-2" }
+// { dg-skip-if "PR c++/124118" *-*-solaris2* }
+// Test std::meta::exception.
+
+#include <meta>
+
+using namespace std::meta;
+
+consteval bool
+bar ()
+{
+  exception a (u8"\N{GRINNING FACE}\N{GRINNING FACE WITH SMILING EYES}\N{LEFT 
SPEECH BUBBLE}", ^^bar);
+  const char *b = a.what ();   // { dg-message "in 'constexpr' expansion of 
'a.std::meta::exception::what\\\(\\\)" }
+  return true;                 // { dg-error "constexpr message: 
std::meta::exception message could not be successfully transcoded from UTF-8 to 
ordinary literal encoding" "" { target *-*-* } 0 }
+}
+
+constexpr auto c = bar ();

        Jakub

Reply via email to