aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/lex/lex.literal/lex.ext/p8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/lex/lex.literal/lex.ext/p8.cpp')
-rw-r--r--test/CXX/lex/lex.literal/lex.ext/p8.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/CXX/lex/lex.literal/lex.ext/p8.cpp b/test/CXX/lex/lex.literal/lex.ext/p8.cpp
index 2833769d73..d9078221ff 100644
--- a/test/CXX/lex/lex.literal/lex.ext/p8.cpp
+++ b/test/CXX/lex/lex.literal/lex.ext/p8.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++11 -verify %s
-constexpr const char *operator "" _id(const char *p) { return p; }
+using size_t = decltype(sizeof(int));
+constexpr const char *operator "" _id(const char *p, size_t) { return p; }
constexpr const char *s = "foo"_id "bar" "baz"_id "quux";
constexpr bool streq(const char *p, const char *q) {
@@ -8,12 +9,10 @@ constexpr bool streq(const char *p, const char *q) {
}
static_assert(streq(s, "foobarbazquux"), "");
-constexpr const char *operator "" _trim(const char *p) {
- return *p == ' ' ? operator "" _trim(p + 1) : p;
+constexpr const char *operator "" _trim(const char *p, size_t n) {
+ return *p == ' ' ? operator "" _trim(p + 1, n - 1) : p;
}
constexpr const char *t = " " " "_trim " foo";
-// FIXME: once we implement the semantics of user-defined literals, this should
-// pass.
-static_assert(streq(s, "foo"), ""); // expected-error {{static_assert}}
+static_assert(streq(t, "foo"), "");
const char *u = "foo" "bar"_id "baz" "quux"_di "corge"; // expected-error {{differing user-defined suffixes ('_id' and '_di') in string literal concatenation}}