b773000d359159dd3205ade011bb0b3f1e2d5422
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / pr61038.C
1 // PR c++/61038
2 // { dg-do compile { target c++11 } }
3
4 #include <cstring>
5 #include <cstdlib>
6
7 void
8 operator "" _s(const char *, unsigned long)
9 { }
10
11 void
12 operator "" _t(const char)
13 { }
14
15 #define QUOTE(s) #s
16 #define QQUOTE(s) QUOTE(s)
17
18 int
19 main()
20 {
21 const char *s = QQUOTE(QUOTE("hello"_s));
22 const char *t = QUOTE("\"hello\"_s");
23 if (strcmp(s, t) != 0)
24 abort();
25
26 const char *c = QQUOTE(QUOTE('"'_t));
27 const char *d = QUOTE("'\"'_t");
28 if (strcmp(c, d) != 0)
29 abort();
30
31 const char *e = QQUOTE(QUOTE('\''_t));
32 const char *f = QUOTE("'\\''_t");
33 if (strcmp(e, f) != 0)
34 abort();
35
36 const char *g = QQUOTE(QUOTE('\\'_t));
37 const char *h = QUOTE("'\\\\'_t");
38 if (strcmp(g, h) != 0)
39 abort();
40 }