This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [REVISED PATCH 4/9]: C++ P0482R5 char8_t: Updates to existing core language tests


Attached is a revised patch that addresses changes in P0482R6 and adoption of P0482R6 for C++20 in San Diego. Changes from the prior patch include:
- Updated a test to validate the value of the __cpp_char8_t feature test
  macro when targeting C++2a.

Tested on x86_64-linux.

gcc/testsuite/ChangeLog:

2018-11-04  Tom Honermann  <tom@honermann.net>

     * c-c++-common/raw-string-13.c: Added test cases for u8 raw string
     literals.
     * c-c++-common/raw-string-15.c: Likewise.
     * g++.dg/cpp0x/constexpr-wstring2.C: Added test cases for u8
     literals.
     * g++.dg/cpp2a/feat-cxx2a.C: Added test cases for the __cpp_char8_t
     feature test macro.
     * g++.dg/ext/utf-array-short-wchar.C: Likewise.
     * g++.dg/ext/utf-array.C: Likewise.
     * g++.dg/ext/utf-cxx98.C: Likewise.
     * g++.dg/ext/utf-dflt.C: Likewise.
     * g++.dg/ext/utf-gnuxx98.C: Likewise.
     * gcc.dg/utf-array-short-wchar.c: Likewise.
     * gcc.dg/utf-array.c: Likewise.

Tom.


diff --git a/gcc/testsuite/c-c++-common/raw-string-13.c b/gcc/testsuite/c-c++-common/raw-string-13.c
index 1b37405cee9..fa11edaa7aa 100644
--- a/gcc/testsuite/c-c++-common/raw-string-13.c
+++ b/gcc/testsuite/c-c++-common/raw-string-13.c
@@ -62,6 +62,47 @@ const char s16[] = R"??(??)??";
 const char s17[] = R"?(?)??)?";
 const char s18[] = R"??(??)??)??)??";
 
+const char u800[] = u8R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char u801[] = u8R"a(
+)\
+a"
+)a";
+const char u802[] = u8R"a(
+)a\
+"
+)a";
+const char u803[] = u8R"ab(
+)a\
+b"
+)ab";
+const char u804[] = u8R"a??/(x)a??/";
+const char u805[] = u8R"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char u806[] = u8R"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char u807[] = u8R"abc(??)\
+abc";)abc";
+const char u808[] = u8R"def(de)\
+def";)def";
+const char u809[] = u8R"a(??)\
+a"
+)a";
+const char u810[] = u8R"a(??)a\
+"
+)a";
+const char u811[] = u8R"ab(??)a\
+b"
+)ab";
+const char u812[] = u8R"a#(a#)a??=)a#";
+const char u813[] = u8R"a#(??)a??=??)a#";
+const char u814[] = u8R"??/(x)??/
+";)??/";
+const char u815[] = u8R"??/(??)??/
+";)??/";
+const char u816[] = u8R"??(??)??";
+const char u817[] = u8R"?(?)??)?";
+const char u818[] = u8R"??(??)??)??)??";
+
 const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
 (a)#[{}]^|~";
 )??=??";
@@ -211,6 +252,25 @@ main (void)
   TEST (s16, "??");
   TEST (s17, "?)??");
   TEST (s18, "??"")??"")??");
+  TEST (u800, u8"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+  TEST (u801, u8"\n)\\\na\"\n");
+  TEST (u802, u8"\n)a\\\n\"\n");
+  TEST (u803, u8"\n)a\\\nb\"\n");
+  TEST (u804, u8"x");
+  TEST (u805, u8"abc");
+  TEST (u806, u8"abc");
+  TEST (u807, u8"??"")\\\nabc\";");
+  TEST (u808, u8"de)\\\ndef\";");
+  TEST (u809, u8"??"")\\\na\"\n");
+  TEST (u810, u8"??"")a\\\n\"\n");
+  TEST (u811, u8"??"")a\\\nb\"\n");
+  TEST (u812, u8"a#)a??""=");
+  TEST (u813, u8"??"")a??""=??");
+  TEST (u814, u8"x)??""/\n\";");
+  TEST (u815, u8"??"")??""/\n\";");
+  TEST (u816, u8"??");
+  TEST (u817, u8"?)??");
+  TEST (u818, u8"??"")??"")??");
   TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
   TEST (u01, u"\n)\\\na\"\n");
   TEST (u02, u"\n)a\\\n\"\n");
diff --git a/gcc/testsuite/c-c++-common/raw-string-15.c b/gcc/testsuite/c-c++-common/raw-string-15.c
index 9dfdaabd87d..1d101dc8393 100644
--- a/gcc/testsuite/c-c++-common/raw-string-15.c
+++ b/gcc/testsuite/c-c++-common/raw-string-15.c
@@ -62,6 +62,47 @@ const char s16[] = R"??(??)??";
 const char s17[] = R"?(?)??)?";
 const char s18[] = R"??(??)??)??)??";
 
+const char u800[] = u8R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char u801[] = u8R"a(
+)\
+a"
+)a";
+const char u802[] = u8R"a(
+)a\
+"
+)a";
+const char u803[] = u8R"ab(
+)a\
+b"
+)ab";
+const char u804[] = u8R"a??/(x)a??/";
+const char u805[] = u8R"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char u806[] = u8R"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char u807[] = u8R"abc(??)\
+abc";)abc";
+const char u808[] = u8R"def(de)\
+def";)def";
+const char u809[] = u8R"a(??)\
+a"
+)a";
+const char u810[] = u8R"a(??)a\
+"
+)a";
+const char u811[] = u8R"ab(??)a\
+b"
+)ab";
+const char u812[] = u8R"a#(a#)a??=)a#";
+const char u813[] = u8R"a#(??)a??=??)a#";
+const char u814[] = u8R"??/(x)??/
+";)??/";
+const char u815[] = u8R"??/(??)??/
+";)??/";
+const char u816[] = u8R"??(??)??";
+const char u817[] = u8R"?(?)??)?";
+const char u818[] = u8R"??(??)??)??)??";
+
 const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
 (a)#[{}]^|~";
 )??=??";
@@ -211,6 +252,25 @@ main (void)
   TEST (s16, "??");
   TEST (s17, "?)??");
   TEST (s18, "??"")??"")??");
+  TEST (u800, u8"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+  TEST (u801, u8"\n)\\\na\"\n");
+  TEST (u802, u8"\n)a\\\n\"\n");
+  TEST (u803, u8"\n)a\\\nb\"\n");
+  TEST (u804, u8"x");
+  TEST (u805, u8"abc");
+  TEST (u806, u8"abc");
+  TEST (u807, u8"??"")\\\nabc\";");
+  TEST (u808, u8"de)\\\ndef\";");
+  TEST (u809, u8"??"")\\\na\"\n");
+  TEST (u810, u8"??"")a\\\n\"\n");
+  TEST (u811, u8"??"")a\\\nb\"\n");
+  TEST (u812, u8"a#)a??""=");
+  TEST (u813, u8"??"")a??""=??");
+  TEST (u814, u8"x)??""/\n\";");
+  TEST (u815, u8"??"")??""/\n\";");
+  TEST (u816, u8"??");
+  TEST (u817, u8"?)??");
+  TEST (u818, u8"??"")??"")??");
   TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
   TEST (u01, u"\n)\\\na\"\n");
   TEST (u02, u"\n)a\\\n\"\n");
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C
index 4055e0ee8ec..b878918a9f3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C
@@ -4,3 +4,4 @@
 constexpr wchar_t c1 = L"hi"[3];	// { dg-error "array subscript" }
 constexpr char16_t c2 = u"hi"[3];	// { dg-error "array subscript" }
 constexpr char32_t c3 = U"hi"[3];	// { dg-error "array subscript" }
+constexpr char c4 = u8"hi"[3];		// { dg-error "array subscript" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
index b97c84c75bb..b28fcb9ee2c 100644
--- a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
+++ b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
@@ -445,3 +445,11 @@
 #else
 #  error "__has_cpp_attribute"
 #endif
+
+// C++2A features:
+
+#ifndef __cpp_char8_t
+#  error "__cpp_char8_t"
+#elif __cpp_char8_t != 201811
+#  error "__cpp_char8_t != 201811"
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C b/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C
index 2ce774abc4a..6e0e4a0c7e9 100644
--- a/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C
+++ b/gcc/testsuite/g++.dg/ext/utf-array-short-wchar.C
@@ -7,30 +7,34 @@ const char	s_0[]	= "ab";
 const char	s_1[]	= u"ab";	/* { dg-error "from wide string" } */
 const char	s_2[]	= U"ab";	/* { dg-error "from wide string" } */
 const char	s_3[]	= L"ab";	/* { dg-error "from wide string" } */
+const char	s_4[]	= u8"ab";
 
 const char16_t	s16_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char16_t	s16_1[]	= u"ab";
 const char16_t	s16_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const char16_t	s16_3[]	= L"ab";	/* { dg-error "from incompatible" } */
+const char16_t	s16_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char16_t	s16_4[0] = u"ab";	/* { dg-error "chars is too long" } */
-const char16_t	s16_5[1] = u"ab";	/* { dg-error "chars is too long" } */
-const char16_t	s16_6[2] = u"ab";	/* { dg-error "chars is too long" } */
-const char16_t	s16_7[3] = u"ab";
-const char16_t	s16_8[4] = u"ab";
+const char16_t	s16_5[0] = u"ab";	/* { dg-error "chars is too long" } */
+const char16_t	s16_6[1] = u"ab";	/* { dg-error "chars is too long" } */
+const char16_t	s16_7[2] = u"ab";	/* { dg-error "chars is too long" } */
+const char16_t	s16_8[3] = u"ab";
+const char16_t	s16_9[4] = u"ab";
 
 const char32_t	s32_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char32_t	s32_1[]	= u"ab";	/* { dg-error "from incompatible" } */
 const char32_t	s32_2[]	= U"ab";
 const char32_t	s32_3[]	= L"ab";	/* { dg-error "from incompatible" } */
+const char32_t	s32_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char32_t	s32_4[0] = U"ab";	/* { dg-error "chars is too long" } */
-const char32_t	s32_5[1] = U"ab";	/* { dg-error "chars is too long" } */
-const char32_t	s32_6[2] = U"ab";	/* { dg-error "chars is too long" } */
-const char32_t	s32_7[3] = U"ab";
-const char32_t	s32_8[4] = U"ab";
+const char32_t	s32_5[0] = U"ab";	/* { dg-error "chars is too long" } */
+const char32_t	s32_6[1] = U"ab";	/* { dg-error "chars is too long" } */
+const char32_t	s32_7[2] = U"ab";	/* { dg-error "chars is too long" } */
+const char32_t	s32_8[3] = U"ab";
+const char32_t	s32_9[4] = U"ab";
 
 const wchar_t	sw_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const wchar_t	sw_1[]	= u"ab";	/* { dg-error "from incompatible" } */
 const wchar_t	sw_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const wchar_t	sw_3[]	= L"ab";
+const wchar_t	sw_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
diff --git a/gcc/testsuite/g++.dg/ext/utf-array.C b/gcc/testsuite/g++.dg/ext/utf-array.C
index 21e438693a2..fcdf75d7650 100644
--- a/gcc/testsuite/g++.dg/ext/utf-array.C
+++ b/gcc/testsuite/g++.dg/ext/utf-array.C
@@ -7,30 +7,34 @@ const char	s_0[]	= "ab";
 const char	s_1[]	= u"ab";	/* { dg-error "from wide string" } */
 const char	s_2[]	= U"ab";	/* { dg-error "from wide string" } */
 const char	s_3[]	= L"ab";	/* { dg-error "from wide string" } */
+const char	s_4[]	= u8"ab";
 
 const char16_t	s16_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char16_t	s16_1[]	= u"ab";
 const char16_t	s16_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const char16_t	s16_3[]	= L"ab";	/* { dg-error "from incompatible" } */
+const char16_t	s16_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char16_t	s16_4[0] = u"ab";	/* { dg-error "chars is too long" } */
-const char16_t	s16_5[1] = u"ab";	/* { dg-error "chars is too long" } */
-const char16_t	s16_6[2] = u"ab";	/* { dg-error "chars is too long" } */
-const char16_t	s16_7[3] = u"ab";
-const char16_t	s16_8[4] = u"ab";
+const char16_t	s16_5[0] = u"ab";	/* { dg-error "chars is too long" } */
+const char16_t	s16_6[1] = u"ab";	/* { dg-error "chars is too long" } */
+const char16_t	s16_7[2] = u"ab";	/* { dg-error "chars is too long" } */
+const char16_t	s16_8[3] = u"ab";
+const char16_t	s16_9[4] = u"ab";
 
 const char32_t	s32_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char32_t	s32_1[]	= u"ab";	/* { dg-error "from incompatible" } */
 const char32_t	s32_2[]	= U"ab";
 const char32_t	s32_3[]	= L"ab";	/* { dg-error "from incompatible" } */
+const char32_t	s32_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char32_t	s32_4[0] = U"ab";	/* { dg-error "chars is too long" } */
-const char32_t	s32_5[1] = U"ab";	/* { dg-error "chars is too long" } */
-const char32_t	s32_6[2] = U"ab";	/* { dg-error "chars is too long" } */
-const char32_t	s32_7[3] = U"ab";
-const char32_t	s32_8[4] = U"ab";
+const char32_t	s32_5[0] = U"ab";	/* { dg-error "chars is too long" } */
+const char32_t	s32_6[1] = U"ab";	/* { dg-error "chars is too long" } */
+const char32_t	s32_7[2] = U"ab";	/* { dg-error "chars is too long" } */
+const char32_t	s32_8[3] = U"ab";
+const char32_t	s32_9[4] = U"ab";
 
 const wchar_t	sw_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const wchar_t	sw_1[]	= u"ab";	/* { dg-error "from incompatible" } */
 const wchar_t	sw_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const wchar_t	sw_3[]	= L"ab";
+const wchar_t	sw_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
diff --git a/gcc/testsuite/g++.dg/ext/utf-cxx98.C b/gcc/testsuite/g++.dg/ext/utf-cxx98.C
index 365118e3964..ada97be5ef6 100644
--- a/gcc/testsuite/g++.dg/ext/utf-cxx98.C
+++ b/gcc/testsuite/g++.dg/ext/utf-cxx98.C
@@ -1,27 +1,33 @@
 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
 /* Expected errors for char16_t/char32_t in c++98. */
-/* Ensure u and U prefixes are parsed as separate tokens in c++98. */
+/* Ensure u8, u and U prefixes are parsed as separate tokens in c++98. */
 /* { dg-do compile } */
 /* { dg-options "-std=c++98" } */
 
 const static char16_t	c0	= 'a';	/* { dg-error "not name a type" } */
 const static char32_t	c1	= 'a';	/* { dg-error "not name a type" } */
 
-const unsigned short	c2	= u'a';	/* { dg-error "not declared" } */
-const unsigned long	c3	= U'a';	/* { dg-error "not declared" } */
+const unsigned short	c2	= u'a';		/* { dg-error "not declared" } */
+const unsigned long	c3	= U'a';		/* { dg-error "not declared" } */
+const unsigned char	c4	= u8'a';	/* { dg-error "not declared" } */
 
 #define u	1 +
 #define U	2 +
+#define u8	3 +
 
 const unsigned short	c5	= u'a';
 const unsigned long	c6	= U'a';
+const unsigned char	c7	= u8'a';
 
 #undef u
 #undef U
+#undef u8
 #define u	"a"
 #define U	"b"
+#define u8	"c"
 
 const void		*s0	= u"a";
 const void		*s1	= U"a";
+const void		*s2	= u8"a";
 
 int main () {}
diff --git a/gcc/testsuite/g++.dg/ext/utf-dflt.C b/gcc/testsuite/g++.dg/ext/utf-dflt.C
index c2b127d5dda..6bf020f7cdb 100644
--- a/gcc/testsuite/g++.dg/ext/utf-dflt.C
+++ b/gcc/testsuite/g++.dg/ext/utf-dflt.C
@@ -1,27 +1,33 @@
 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
 /* Expected errors for char16_t/char32_t in default std. */
-/* Ensure u and U prefixes are parsed as separate tokens in default std. */
+/* Ensure u8, u and U prefixes are parsed as separate tokens in default std. */
 /* { dg-do compile } */
 /* { dg-options "-std=c++98" } */
 
 const static char16_t	c0	= 'a';	/* { dg-error "not name a type" } */
 const static char32_t	c1	= 'a';	/* { dg-error "not name a type" } */
 
-const unsigned short	c2	= u'a';	/* { dg-error "not declared" } */
-const unsigned long	c3	= U'a';	/* { dg-error "not declared" } */
+const unsigned short	c2	= u'a';		/* { dg-error "not declared" } */
+const unsigned long	c3	= U'a';		/* { dg-error "not declared" } */
+const unsigned char	c4	= u8'a';	/* { dg-error "not declared" } */
 
 #define u	1 +
 #define U	2 +
+#define u8	3 +
 
-const unsigned short	c4	= u'a';
-const unsigned long	c5	= U'a';
+const unsigned short	c5	= u'a';
+const unsigned long	c6	= U'a';
+const unsigned char	c7	= u8'a';
 
 #undef u
 #undef U
+#undef u8
 #define u	"a"
 #define U	"b"
+#define u8	"c"
 
 const void		*s0	= u"a";
 const void		*s1	= U"a";
+const void		*s2	= u8"a";
 
 int main () {}
diff --git a/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C b/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C
index b3be121e2dc..dc9a814c161 100644
--- a/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C
+++ b/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C
@@ -1,27 +1,33 @@
 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
 /* Expected errors for char16_t/char32_t in gnu++98. */
-/* Ensure u and U prefixes are parsed as separate tokens in gnu++98. */
+/* Ensure u8, u and U prefixes are parsed as separate tokens in gnu++98. */
 /* { dg-do compile } */
 /* { dg-options "-std=gnu++98" } */
 
 const static char16_t	c0	= 'a';	/* { dg-error "not name a type" } */
 const static char32_t	c1	= 'a';	/* { dg-error "not name a type" } */
 
-const unsigned short	c2	= u'a';	/* { dg-error "not declared" } */
-const unsigned long	c3	= U'a';	/* { dg-error "not declared" } */
+const unsigned short	c2	= u'a';		/* { dg-error "not declared" } */
+const unsigned long	c3	= U'a';		/* { dg-error "not declared" } */
+const unsigned char	c4	= u8'a';	/* { dg-error "not declared" } */
 
 #define u	1 +
 #define U	2 +
+#define u8	3 +
 
 const unsigned short	c5	= u'a';
 const unsigned long	c6	= U'a';
+const unsigned char	c7	= u8'a';
 
 #undef u
 #undef U
+#undef u8
 #define u	"a"
 #define U	"b"
+#define u8	"c"
 
 const void		*s0	= u"a";
 const void		*s1	= U"a";
+const void		*s2	= u8"a";
 
 int main () {}
diff --git a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
index ec478121a07..c5da939f34e 100644
--- a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
+++ b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
@@ -13,30 +13,34 @@ const char	s_0[]	= "ab";
 const char	s_1[]	= u"ab";	/* { dg-error "from wide string" } */
 const char	s_2[]	= U"ab";	/* { dg-error "from wide string" } */
 const char	s_3[]	= L"ab";	/* { dg-error "from wide string" } */
+const char	s_4[]	= u8"ab";
 
 const char16_t	s16_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char16_t	s16_1[]	= u"ab";
 const char16_t	s16_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const char16_t	s16_3[]	= L"ab";
+const char16_t	s16_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char16_t	s16_4[0] = u"ab";	/* { dg-warning "chars is too long" } */
-const char16_t	s16_5[1] = u"ab";	/* { dg-warning "chars is too long" } */
-const char16_t	s16_6[2] = u"ab";
-const char16_t	s16_7[3] = u"ab";
-const char16_t	s16_8[4] = u"ab";
+const char16_t	s16_5[0] = u"ab";	/* { dg-warning "chars is too long" } */
+const char16_t	s16_6[1] = u"ab";	/* { dg-warning "chars is too long" } */
+const char16_t	s16_7[2] = u"ab";
+const char16_t	s16_8[3] = u"ab";
+const char16_t	s16_9[4] = u"ab";
 
 const char32_t	s32_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char32_t	s32_1[]	= u"ab";	/* { dg-error "from incompatible" } */
 const char32_t	s32_2[]	= U"ab";
 const char32_t	s32_3[]	= L"ab";	/* { dg-error "from incompatible" } */
+const char32_t	s32_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char32_t	s32_4[0] = U"ab";	/* { dg-warning "chars is too long" } */
-const char32_t	s32_5[1] = U"ab";	/* { dg-warning "chars is too long" } */
-const char32_t	s32_6[2] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
-const char32_t	s32_7[3] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
-const char32_t	s32_8[4] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
+const char32_t	s32_5[0] = U"ab";	/* { dg-warning "chars is too long" } */
+const char32_t	s32_6[1] = U"ab";	/* { dg-warning "chars is too long" } */
+const char32_t	s32_7[2] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
+const char32_t	s32_8[3] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
+const char32_t	s32_9[4] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
 
 const wchar_t	sw_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const wchar_t	sw_1[]	= u"ab";
 const wchar_t	sw_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const wchar_t	sw_3[]	= L"ab";
+const wchar_t	sw_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
diff --git a/gcc/testsuite/gcc.dg/utf-array.c b/gcc/testsuite/gcc.dg/utf-array.c
index 433ddcfaf48..1d864220c98 100644
--- a/gcc/testsuite/gcc.dg/utf-array.c
+++ b/gcc/testsuite/gcc.dg/utf-array.c
@@ -13,30 +13,34 @@ const char	s_0[]	= "ab";
 const char	s_1[]	= u"ab";	/* { dg-error "from wide string" } */
 const char	s_2[]	= U"ab";	/* { dg-error "from wide string" } */
 const char	s_3[]	= L"ab";	/* { dg-error "from wide string" } */
+const char	s_4[]	= u8"ab";
 
 const char16_t	s16_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char16_t	s16_1[]	= u"ab";
 const char16_t	s16_2[]	= U"ab";	/* { dg-error "from incompatible" } */
 const char16_t	s16_3[]	= L"ab";	/* { dg-error "from incompatible" "" { target { ! wchar_t_char16_t_compatible } } } */
+const char16_t	s16_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char16_t	s16_4[0] = u"ab";	/* { dg-warning "chars is too long" } */
-const char16_t	s16_5[1] = u"ab";	/* { dg-warning "chars is too long" } */
-const char16_t	s16_6[2] = u"ab";
-const char16_t	s16_7[3] = u"ab";
-const char16_t	s16_8[4] = u"ab";
+const char16_t	s16_5[0] = u"ab";	/* { dg-warning "chars is too long" } */
+const char16_t	s16_6[1] = u"ab";	/* { dg-warning "chars is too long" } */
+const char16_t	s16_7[2] = u"ab";
+const char16_t	s16_8[3] = u"ab";
+const char16_t	s16_9[4] = u"ab";
 
 const char32_t	s32_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const char32_t	s32_1[]	= u"ab";	/* { dg-error "from incompatible" } */
 const char32_t	s32_2[]	= U"ab";
 const char32_t	s32_3[]	= L"ab";	/* { dg-error "from incompatible" "" { target { ! wchar_t_char32_t_compatible } } } */
+const char32_t	s32_4[]	= u8"ab";	/* { dg-error "from non-wide" } */
 
-const char32_t	s32_4[0] = U"ab";	/* { dg-warning "chars is too long" } */
-const char32_t	s32_5[1] = U"ab";	/* { dg-warning "chars is too long" } */
-const char32_t	s32_6[2] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
-const char32_t	s32_7[3] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
-const char32_t	s32_8[4] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
+const char32_t	s32_5[0] = U"ab";	/* { dg-warning "chars is too long" } */
+const char32_t	s32_6[1] = U"ab";	/* { dg-warning "chars is too long" } */
+const char32_t	s32_7[2] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
+const char32_t	s32_8[3] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
+const char32_t	s32_9[4] = U"ab";	/* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
 
 const wchar_t	sw_0[]	= "ab";		/* { dg-error "from non-wide" } */
 const wchar_t	sw_1[]	= u"ab";	/* { dg-error "from incompatible" "" { target { ! wchar_t_char16_t_compatible } } } */
 const wchar_t	sw_2[]	= U"ab";	/* { dg-error "from incompatible" "" { target { ! wchar_t_char32_t_compatible } } } */
 const wchar_t	sw_3[]	= L"ab";
+const wchar_t	sw_4[]	= u8"ab";	/* { dg-error "from non-wide" } */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]