On Fri, Oct 04, 2024 at 12:19:03PM +0200, Jakub Jelinek wrote:
> Though, maybe the tests should have both the deprecated syntax and the
> non-deprecated one...

Here is a variant of the patch which does that.

Tested on x86_64-linux and i686-linux, ok for trunk?

2024-10-04  Jakub Jelinek  <ja...@redhat.com>

        * g++.dg/cpp26/unevalstr1.C: Revert the 2024-10-03 changes, instead
        expect extra warnings.  Add another set of tests without space
        between " and _.
        * g++.dg/cpp26/unevalstr2.C: Expect extra warnings for C++23.  Add
        another set of tests without space between " and _.

--- gcc/testsuite/g++.dg/cpp26/unevalstr1.C.jj  2024-10-04 12:28:08.820899177 
+0200
+++ gcc/testsuite/g++.dg/cpp26/unevalstr1.C     2024-10-04 14:15:35.563531334 
+0200
@@ -83,21 +83,57 @@ extern "\o{0103}" { int f14 (); }   // { d
 [[nodiscard ("\x{20}")]] int h19 ();   // { dg-error "numeric escape sequence 
in unevaluated string" }
 [[nodiscard ("\h")]] int h20 ();       // { dg-error "unknown escape sequence" 
}
 
-float operator ""_my0 (const char *);
-float operator "" ""_my1 (const char *);
-float operator L""_my2 (const char *); // { dg-error "invalid encoding prefix 
in literal operator" }
-float operator u""_my3 (const char *); // { dg-error "invalid encoding prefix 
in literal operator" }
-float operator U""_my4 (const char *); // { dg-error "invalid encoding prefix 
in literal operator" }
-float operator u8""_my5 (const char *);        // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator L"" ""_my6 (const char *);      // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator u"" ""_my7 (const char *);      // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator U"" ""_my8 (const char *);      // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator u8"" ""_my9 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator "" L""_my10 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator "" u""_my11 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator "" U""_my12 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator "" u8""_my13 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator "\0"_my14 (const char *);       // { dg-error "expected empty 
string after 'operator' keyword" }
-float operator "\x00"_my15 (const char *);     // { dg-error "expected empty 
string after 'operator' keyword" }
-float operator "\h"_my16 (const char *);       // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "" _my0 (const char *);
+float operator "" "" _my1 (const char *);
+float operator L"" _my2 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u"" _my3 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator U"" _my4 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u8"" _my5 (const char *);       // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator L"" "" _my6 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator u"" "" _my7 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator U"" "" _my8 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator u8"" "" _my9 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" L"" _my10 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" u"" _my11 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" U"" _my12 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" u8"" _my13 (const char *);   // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "\0" _my14 (const char *);      // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "\x00" _my15 (const char *);    // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "\h" _my16 (const char *);      // { dg-error "expected empty 
string after 'operator' keyword" }
+                                               // { dg-error "unknown escape 
sequence" "" { target *-*-* } .-1 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
*-*-* } .-18 }
+
+float operator ""_my20 (const char *);
+float operator "" ""_my21 (const char *);
+float operator L""_my22 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u""_my23 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator U""_my24 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u8""_my25 (const char *);       // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator L"" ""_my26 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator u"" ""_my27 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator U"" ""_my28 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator u8"" ""_my29 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" L""_my30 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" u""_my31 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" U""_my32 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" u8""_my33 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "\0"_my34 (const char *);       // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "\x00"_my35 (const char *);     // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "\h"_my36 (const char *);       // { dg-error "expected empty 
string after 'operator' keyword" }
                                                // { dg-error "unknown escape 
sequence" "" { target *-*-* } .-1 }
--- gcc/testsuite/g++.dg/cpp26/unevalstr2.C.jj  2023-11-02 07:49:18.266848975 
+0100
+++ gcc/testsuite/g++.dg/cpp26/unevalstr2.C     2024-10-04 14:16:47.709529527 
+0200
@@ -92,9 +92,9 @@ extern "\o{0103}" { int f14 (); }     // { d
 
 float operator "" _my0 (const char *);
 float operator "" "" _my1 (const char *);
-float operator L"" _my2 (const char *);        // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator u"" _my3 (const char *);        // { dg-error "invalid encoding 
prefix in literal operator" }
-float operator U"" _my4 (const char *);        // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator L"" _my2 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u"" _my3 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator U"" _my4 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
 float operator u8"" _my5 (const char *);       // { dg-error "invalid encoding 
prefix in literal operator" }
 float operator L"" "" _my6 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
 float operator u"" "" _my7 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
@@ -108,3 +108,39 @@ float operator "\0" _my14 (const char *)
 float operator "\x00" _my15 (const char *);    // { dg-error "expected empty 
string after 'operator' keyword" }
 float operator "\h" _my16 (const char *);      // { dg-error "expected empty 
string after 'operator' keyword" }
                                                // { dg-warning "unknown escape 
sequence" "" { target *-*-* } .-1 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+// { dg-warning "space between quotes and suffix is deprecated" "" { target 
c++23 } .-18 }
+
+float operator ""_my20 (const char *);
+float operator "" ""_my21 (const char *);
+float operator L""_my22 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u""_my23 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator U""_my24 (const char *);                // { dg-error "invalid 
encoding prefix in literal operator" }
+float operator u8""_my25 (const char *);       // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator L"" ""_my26 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator u"" ""_my27 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator U"" ""_my28 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator u8"" ""_my29 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" L""_my30 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" u""_my31 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" U""_my32 (const char *);     // { dg-error "invalid encoding 
prefix in literal operator" }
+float operator "" u8""_my33 (const char *);    // { dg-error "invalid encoding 
prefix in literal operator" "" { target c++20 } }
+float operator "\0"_my34 (const char *);       // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "\x00"_my35 (const char *);     // { dg-error "expected empty 
string after 'operator' keyword" }
+float operator "\h"_my36 (const char *);       // { dg-error "expected empty 
string after 'operator' keyword" }
+                                               // { dg-warning "unknown escape 
sequence" "" { target *-*-* } .-1 }

        Jakub

Reply via email to