gcc/testsuite/g++.dg/cpp0x/udlit-inline.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // Literal operators can be inline. |
| 4 | |
| 5 | inline int |
| 6 | operator ""_thing1(char cc) |
| 7 | { return 42 * cc; } |
| 8 | |
| 9 | int operator ""_thing2(char cc); |
| 10 | |
| 11 | class Foo |
| 12 | { |
| 13 | int |
| 14 | friend operator ""_thing2(char cc) |
| 15 | { return 42 * cc; } |
| 16 | }; |
| 17 | |
| 18 | int i = operator ""_thing1('x'); |
| 19 | int j = 'x'_thing1; |
| 20 | |
| 21 | int iF = operator ""_thing2('x'); |
| 22 | int jF = 'x'_thing2; |