OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / udlit-embed-quote.C
1 // { dg-do run }
2 // { dg-options "-std=c++0x" }
3
4 //  Make sure embedded quotes are not a problem for string and char literals.
5
6 #include <cstdint>
7 #include <cassert>
8
9 int operator"" _embedchar(char)
10 { return 41; };
11
12 int operator"" _embedstr(const char*, std::size_t len)
13 { return 42 + len; };
14
15 void
16 test()
17 {
18   int i = '\''_embedchar;
19
20   int j = "\""_embedstr;
21   assert(j == 43);
22
23   int k = "foo\""_embedstr;
24   assert(k == 46);
25
26   int l = "\"bar"_embedstr;
27   assert(l == 46);
28 }
29
30 int
31 main()
32 {
33   test();
34 }