| 1 |
// PR c++/105300 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
void operator""_x(const char *, decltype(sizeof(0))); |
| 5 |
|
| 6 |
#include ""_x // { dg-error "'#include' expects" } |
| 7 |
#line ""_x // { dg-error "not a positive integer" } |
| 8 |
#if __has_include(""_x) // { dg-error "requires a header-name" } |
| 9 |
#endif |
| 10 |
|
| 11 |
#pragma message "hi"_x // { dg-warning "string literal with user-defined suffix is invalid in this context" } |
| 12 |
|
| 13 |
extern "C"_x { void g(); } // { dg-error "before user-defined string literal" } |
| 14 |
static_assert(true, "foo"_x); // { dg-error "'static_assert' with non-string message only available with" "" { target c++23_down } } |
| 15 |
// { dg-error "constexpr string must be a string literal or object with 'size' and 'data' members" "" { target *-*-* } .-1 } |
| 16 |
// { dg-error "invalid use of 'void'" "" { target *-*-* } .-2 } |
| 17 |
|
| 18 |
[[deprecated("oof"_x)]] // { dg-error "string literal with user-defined suffix is invalid in this context" "" { target c++26 } } |
| 19 |
void |
| 20 |
lol () // { dg-error "not a string" } |
| 21 |
{ |
| 22 |
asm (""_x); // { dg-error "string literal with user-defined suffix is invalid in this context" } |
| 23 |
} |