testsuite: Add testcase from C++23 P2314R4 - Character sets and encodings
Commit Message
Hi!
I've read the paper and I believe we just implement it with no changes
needed (at least since PR67224 and similar libcpp changes in GCC 10),
but I could be wrong.
The following patch at least adds a testcase from the start of the paper.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Do you agree that we can mark the paper as implemented or do you think
we need to change something (what?)?
2022-11-04 Jakub Jelinek <jakub@redhat.com>
* g++.dg/cpp23/charset1.C: New testcase from C++23 P2314R4.
Jakub
Comments
On 11/4/22 05:14, Jakub Jelinek wrote:
> Hi!
>
> I've read the paper and I believe we just implement it with no changes
> needed (at least since PR67224 and similar libcpp changes in GCC 10),
> but I could be wrong.
>
> The following patch at least adds a testcase from the start of the paper.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK.
> Do you agree that we can mark the paper as implemented or do you think
> we need to change something (what?)?
I agree.
> 2022-11-04 Jakub Jelinek <jakub@redhat.com>
>
> * g++.dg/cpp23/charset1.C: New testcase from C++23 P2314R4.
>
> --- gcc/testsuite/g++.dg/cpp23/charset1.C.jj 2022-11-03 10:56:48.114588796 +0100
> +++ gcc/testsuite/g++.dg/cpp23/charset1.C 2022-11-03 10:56:39.162711201 +0100
> @@ -0,0 +1,10 @@
> +// P2314R4
> +// { dg-do compile { target c++23 } }
> +// { dg-options "-finput-charset=UTF-8 -fexec-charset=UTF-8" }
> +
> +#define S(x) # x
> +const char s1[] = S(Köppe); // "Köppe"
> +const char s2[] = S(K\u00f6ppe); // "Köppe"
> +
> +static_assert (sizeof (s1) == 7);
> +static_assert (sizeof (s2) == 7);
>
> Jakub
>
@@ -0,0 +1,10 @@
+// P2314R4
+// { dg-do compile { target c++23 } }
+// { dg-options "-finput-charset=UTF-8 -fexec-charset=UTF-8" }
+
+#define S(x) # x
+const char s1[] = S(Köppe); // "Köppe"
+const char s2[] = S(K\u00f6ppe); // "Köppe"
+
+static_assert (sizeof (s1) == 7);
+static_assert (sizeof (s2) == 7);