diff options
author | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
commit | 173a4f43a911175643bda81ee675e8d9269056ea (patch) | |
tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /test/Parser/cxx11-user-defined-literals.cpp | |
parent | 88f7a7d5251a2d813460274c92decc143a11569b (diff) | |
download | FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.zip FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.tar.gz |
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957
Diffstat (limited to 'test/Parser/cxx11-user-defined-literals.cpp')
-rw-r--r-- | test/Parser/cxx11-user-defined-literals.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/Parser/cxx11-user-defined-literals.cpp b/test/Parser/cxx11-user-defined-literals.cpp index 613c0b9..b89a574 100644 --- a/test/Parser/cxx11-user-defined-literals.cpp +++ b/test/Parser/cxx11-user-defined-literals.cpp @@ -15,7 +15,7 @@ _Pragma("comment(lib, \"foo\"_bar)") // expected-error {{user-defined suffix can #elif __has_include("foo"_bar) // expected-error {{expected "FILENAME" or <FILENAME>}} #endif -extern "C++"_x {} // expected-error {{user-defined suffix cannot be used here}} expected-error {{unknown linkage language}} +extern "C++"_x {} // expected-error {{user-defined suffix cannot be used here}} int f() { asm("mov %eax, %rdx"_foo); // expected-error {{user-defined suffix cannot be used here}} @@ -111,3 +111,35 @@ void operator "" "" U"" // expected-error {{cannot have an encoding prefix}} "" _also_not_char(const char *); void operator "" u8"" "\u0123" "hello"_all_of_the_things ""(const char*); // expected-error {{must be '""'}} + +// Make sure we treat UCNs and UTF-8 as equivalent. +int operator""_µs(unsigned long long) {} // expected-note {{previous}} +int hundred_µs = 50_µs + 50_\u00b5s; +int operator""_\u00b5s(unsigned long long) {} // expected-error {{redefinition of 'operator "" _µs'}} + +int operator""_\U0000212B(long double) {} // expected-note {{previous}} +int hundred_Å = 50.0_Å + 50._\U0000212B; +int operator""_Å(long double) {} // expected-error {{redefinition of 'operator "" _Å'}} + +int operator""_𐀀(char) {} // expected-note {{previous}} +int 𐀀 = '4'_𐀀 + '2'_\U00010000; +int operator""_\U00010000(char) {} // expected-error {{redefinition of 'operator "" _𐀀'}} + +// These all declare the same function. +int operator""_℮""_\u212e""_\U0000212e""(const char*, size_t); +int operator""_\u212e""_\U0000212e""_℮""(const char*, size_t); +int operator""_\U0000212e""_℮""_\u212e""(const char*, size_t); +int mix_ucn_utf8 = ""_℮""_\u212e""_\U0000212e""; + +void operator""_℮""_ℯ(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} +void operator""_℮""_\u212f(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} +void operator""_\u212e""_ℯ(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} +void operator""_\u212e""_\u212f(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} + +void operator""_℮""_℮(unsigned long long) {} // expected-note {{previous}} +void operator""_\u212e""_\u212e(unsigned long long) {} // expected-error {{redefinition}} + +#define ¢ *0.01 // expected-error {{macro name must be an identifier}} +constexpr int operator""_¢(long double d) { return d * 100; } // expected-error {{non-ASCII}} +constexpr int operator""_¢(unsigned long long n) { return n; } // expected-error {{non-ASCII}} +static_assert(0.02_¢ == 2_¢, ""); // expected-error 2{{non-ASCII}} |