Add support for cooked forms of user-defined-integer-literal and
user-defined-floating-literal. Support for raw forms of these literals
to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152302 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Parser/cxx11-user-defined-literals.cpp b/test/Parser/cxx11-user-defined-literals.cpp
index 80ff741..b34680d 100644
--- a/test/Parser/cxx11-user-defined-literals.cpp
+++ b/test/Parser/cxx11-user-defined-literals.cpp
@@ -31,6 +31,12 @@
 #error error
 #endif
 
+// A ud-suffix cannot be used on integer literals in preprocessor constant
+// expressions:
+#if 0_foo // expected-error {{integer literal with user-defined suffix cannot be used in preprocessor constant expression}}
+#error error
+#endif
+
 // But they can appear in expressions.
 constexpr char operator"" _id(char c) { return c; }
 constexpr wchar_t operator"" _id(wchar_t c) { return c; }
@@ -43,6 +49,9 @@
 constexpr const char16_t operator"" _id(const char16_t *p, size_t n) { return *p; }
 constexpr const char32_t operator"" _id(const char32_t *p, size_t n) { return *p; }
 
+constexpr unsigned long long operator"" _id(unsigned long long n) { return n; }
+constexpr long double operator"" _id(long double d) { return d; }
+
 template<int n> struct S {};
 S<"a"_id> sa;
 S<L"b"_id> sb;
@@ -55,30 +64,13 @@
 S<u'y'_id> sy;
 S<U'z'_id> sz;
 
+S<100_id> sn;
+S<(int)1.3_id> sf;
+
 void h() {
   (void)"test"_id "test" L"test";
 }
 
-enum class LitKind { Char, WideChar, Char16, Char32, CharStr, WideStr, Char16Str, Char32Str };
-constexpr LitKind operator"" _kind(char p) { return LitKind::Char; }
-constexpr LitKind operator"" _kind(wchar_t p) { return LitKind::WideChar; }
-constexpr LitKind operator"" _kind(char16_t p) { return LitKind::Char16; }
-constexpr LitKind operator"" _kind(char32_t p) { return LitKind::Char32; }
-constexpr LitKind operator"" _kind(const char *p, size_t n) { return LitKind::CharStr; }
-constexpr LitKind operator"" _kind(const wchar_t *p, size_t n) { return LitKind::WideStr; }
-constexpr LitKind operator"" _kind(const char16_t *p, size_t n) { return LitKind::Char16Str; }
-constexpr LitKind operator"" _kind(const char32_t *p, size_t n) { return LitKind::Char32Str; }
-
-static_assert('x'_kind == LitKind::Char, "");
-static_assert(L'x'_kind == LitKind::WideChar, "");
-static_assert(u'x'_kind == LitKind::Char16, "");
-static_assert(U'x'_kind == LitKind::Char32, "");
-static_assert("foo"_kind == LitKind::CharStr, "");
-static_assert(u8"foo"_kind == LitKind::CharStr, "");
-static_assert(L"foo"_kind == LitKind::WideStr, "");
-static_assert(u"foo"_kind == LitKind::Char16Str, "");
-static_assert(U"foo"_kind == LitKind::Char32Str, "");
-
 // Test source location for suffix is known
 const char *p =
   "foo\nbar" R"x(
@@ -89,7 +81,14 @@
 "and a bit more"
 "and another suffix"_no_such_suffix;
 
-// And for character literals
 char c =
   '\x14'\
 _no_such_suffix; // expected-error {{'_no_such_suffix'}}
+
+int &r =
+1234567\
+_no_such_suffix; // expected-error {{'_no_such_suffix'}}
+
+int k =
+1234567.89\
+_no_such_suffix; // expected-error {{'_no_such_suffix'}}