Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / lex / lex.literal / lex.ext / p8.cpp
blobd9078221ff5e3a82bd5daa35a65e4d7f21f44666
1 // RUN: %clang_cc1 -std=c++11 -verify %s
3 using size_t = decltype(sizeof(int));
4 constexpr const char *operator "" _id(const char *p, size_t) { return p; }
5 constexpr const char *s = "foo"_id "bar" "baz"_id "quux";
7 constexpr bool streq(const char *p, const char *q) {
8 return *p == *q && (!*p || streq(p+1, q+1));
10 static_assert(streq(s, "foobarbazquux"), "");
12 constexpr const char *operator "" _trim(const char *p, size_t n) {
13 return *p == ' ' ? operator "" _trim(p + 1, n - 1) : p;
15 constexpr const char *t = " " " "_trim " foo";
16 static_assert(streq(t, "foo"), "");
18 const char *u = "foo" "bar"_id "baz" "quux"_di "corge"; // expected-error {{differing user-defined suffixes ('_id' and '_di') in string literal concatenation}}