xref: /llvm-project/clang/test/Lexer/cxx2c-raw-strings.cpp (revision 4f09ac7705b3b24492d521a97571404c2e9a1f8e)
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=precxx26,expected -Wc++26-extensions %s
2 // RUN: %clang_cc1 -std=c++2c -fsyntax-only -verify=cxx26,expected -Wpre-c++26-compat %s
3 
main()4 int main() {
5   (void) R"abc`@$(foobar)abc`@$";
6   //precxx26-warning@-1 {{'`' in a raw string literal delimiter is a C++2c extension}}
7   //precxx26-warning@-2 {{'@' in a raw string literal delimiter is a C++2c extension}}
8   //precxx26-warning@-3 {{'$' in a raw string literal delimiter is a C++2c extension}}
9   //cxx26-warning@-4 {{'`' in a raw string literal delimiter is incompatible with standards before C++2c}}
10   //cxx26-warning@-5 {{'@' in a raw string literal delimiter is incompatible with standards before C++2c}}
11   //cxx26-warning@-6 {{'$' in a raw string literal delimiter is incompatible with standards before C++2c}}
12 
13   (void) R"\t()\t";
14   // expected-error@-1 {{invalid character '\' in raw string delimiter}}
15   // expected-error@-2 {{expected expression}}
16 
17   (void) R" () ";
18   // expected-error@-1 {{invalid character ' ' in raw string delimiter}}
19   // expected-error@-2 {{expected expression}}
20 
21   (void) R"\()\";
22   // expected-error@-1 {{invalid character '\' in raw string delimiter}}
23   // expected-error@-2 {{expected expression}}
24 
25   (void) R"@(foo)@";
26   // cxx26-warning@-1 {{'@' in a raw string literal delimiter is incompatible with standards before C++2c}}
27   // precxx26-warning@-2 {{'@' in a raw string literal delimiter is a C++2c extension}}
28 }
29