diff mbox series

C++ PATCH to fix ext/utf8-2.C with -std=c++2a

Message ID 20190520161818.GI7979@redhat.com
State New
Headers show
Series C++ PATCH to fix ext/utf8-2.C with -std=c++2a | expand

Commit Message

Marek Polacek May 20, 2019, 4:18 p.m. UTC
This test fails in C++2a since r271338, because the types in the "aka" differ:
in C++17 and below we print:
  {aka 'const char [3]'}
while in C++2a:
  {aka 'const char8_t [3]'}

We can make the regexp accept both.

Tested on x86_64-linux, ok for trunk?

2019-05-20  Marek Polacek  <polacek@redhat.com>

	* g++.dg/ext/utf8-2.C: Accept both "char" and "char8_t" in aka.

Comments

Marek Polacek May 20, 2019, 4:23 p.m. UTC | #1
On Mon, May 20, 2019 at 12:18:18PM -0400, Marek Polacek wrote:
> This test fails in C++2a since r271338, because the types in the "aka" differ:
> in C++17 and below we print:
>   {aka 'const char [3]'}
> while in C++2a:
>   {aka 'const char8_t [3]'}
> 
> We can make the regexp accept both.

...because we'll print "char8_t" in other modes too, with -fchar8_t.

Marek
Jason Merrill May 20, 2019, 5:43 p.m. UTC | #2
On 5/20/19 12:23 PM, Marek Polacek wrote:
> On Mon, May 20, 2019 at 12:18:18PM -0400, Marek Polacek wrote:
>> This test fails in C++2a since r271338, because the types in the "aka" differ:
>> in C++17 and below we print:
>>    {aka 'const char [3]'}
>> while in C++2a:
>>    {aka 'const char8_t [3]'}
>>
>> We can make the regexp accept both.
> 
> ...because we'll print "char8_t" in other modes too, with -fchar8_t.

OK.

Jason
diff mbox series

Patch

diff --git gcc/testsuite/g++.dg/ext/utf8-2.C gcc/testsuite/g++.dg/ext/utf8-2.C
index 1db5c383fd6..5ce13fbe6be 100644
--- gcc/testsuite/g++.dg/ext/utf8-2.C
+++ gcc/testsuite/g++.dg/ext/utf8-2.C
@@ -12,16 +12,16 @@  const char16_t	s1[]	= u8"ab";	// { dg-error "from a string literal with type arr
 const char32_t  s2[]    = u8"ab";	// { dg-error "from a string literal with type array of .char." }
 const wchar_t   s3[]    = u8"ab";	// { dg-error "from a string literal with type array of .char." }
 
-const u8_char_t      t0[0]   = u8"ab";	// { dg-error "initializer-string for 'const u8_char_t \\\[0]' {aka 'const char \\\[0]'} is too long" }
-const u8_char_t      t1[1]   = u8"ab";	// { dg-error "initializer-string for 'const u8_char_t \\\[1]' {aka 'const char \\\[1]'} is too long" }
-const u8_char_t      t2[2]   = u8"ab";	// { dg-error "initializer-string for 'const u8_char_t \\\[2]' {aka 'const char \\\[2]'} is too long" }
+const u8_char_t      t0[0]   = u8"ab";	// { dg-error "initializer-string for 'const u8_char_t \\\[0]' {aka 'const \(char|char8_t\) \\\[0]'} is too long" }
+const u8_char_t      t1[1]   = u8"ab";	// { dg-error "initializer-string for 'const u8_char_t \\\[1]' {aka 'const \(char|char8_t\) \\\[1]'} is too long" }
+const u8_char_t      t2[2]   = u8"ab";	// { dg-error "initializer-string for 'const u8_char_t \\\[2]' {aka 'const \(char|char8_t\) \\\[2]'} is too long" }
 const u8_char_t      t3[3]   = u8"ab";
 const u8_char_t      t4[4]   = u8"ab";
 
-const u8_char_t      u0[0]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[0]' {aka 'const char \\\[0]'} is too long" }
-const u8_char_t      u1[1]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[1]' {aka 'const char \\\[1]'} is too long" }
-const u8_char_t      u2[2]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[2]' {aka 'const char \\\[2]'} is too long" }
-const u8_char_t      u3[3]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[3]' {aka 'const char \\\[3]'} is too long" }
-const u8_char_t      u4[4]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[4]' {aka 'const char \\\[4]'} is too long" }
+const u8_char_t      u0[0]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[0]' {aka 'const \(char|char8_t\) \\\[0]'} is too long" }
+const u8_char_t      u1[1]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[1]' {aka 'const \(char|char8_t\) \\\[1]'} is too long" }
+const u8_char_t      u2[2]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[2]' {aka 'const \(char|char8_t\) \\\[2]'} is too long" }
+const u8_char_t      u3[3]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[3]' {aka 'const \(char|char8_t\) \\\[3]'} is too long" }
+const u8_char_t      u4[4]   = u8"\u2160.";	// { dg-error "initializer-string for 'const u8_char_t \\\[4]' {aka 'const \(char|char8_t\) \\\[4]'} is too long" }
 const u8_char_t      u5[5]   = u8"\u2160.";
 const u8_char_t      u6[6]   = u8"\u2160.";