diff options
Diffstat (limited to 'test/Lexer')
26 files changed, 318 insertions, 49 deletions
diff --git a/test/Lexer/char-literal-encoding-error.c b/test/Lexer/char-literal-encoding-error.c new file mode 100644 index 0000000..e752de2 --- /dev/null +++ b/test/Lexer/char-literal-encoding-error.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -x c++ %s + +// This file is encoded using ISO-8859-1 + +int main() { + (void)'é'; // expected-warning {{illegal character encoding in character literal}} + (void)u'é'; // expected-error {{illegal character encoding in character literal}} + (void)U'é'; // expected-error {{illegal character encoding in character literal}} + (void)L'é'; // expected-error {{illegal character encoding in character literal}} + + // For narrow character literals, since there is no error, make sure the + // encoding is correct + static_assert((unsigned char)'é' == 0xE9, ""); // expected-warning {{illegal character encoding in character literal}} + static_assert('éé' == 0xE9E9, ""); // expected-warning {{illegal character encoding in character literal}} expected-warning {{multi-character character constant}} +} diff --git a/test/Lexer/char-literal.cpp b/test/Lexer/char-literal.cpp new file mode 100644 index 0000000..5dc5360 --- /dev/null +++ b/test/Lexer/char-literal.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -Wfour-char-constants -fsyntax-only -verify %s + +int a = 'ab'; // expected-warning {{multi-character character constant}} +int b = '\xFF\xFF'; // expected-warning {{multi-character character constant}} +int c = 'APPS'; // expected-warning {{multi-character character constant}} + +char d = '⌘'; // expected-error {{character too large for enclosing character literal type}} +char e = '\u2318'; // expected-error {{character too large for enclosing character literal type}} + +auto f = '\xE2\x8C\x98'; // expected-warning {{multi-character character constant}} + +char16_t g = u'ab'; // expected-error {{Unicode character literals may not contain multiple characters}} +char16_t h = u'\U0010FFFD'; // expected-error {{character too large for enclosing character literal type}} + +wchar_t i = L'ab'; // expected-warning {{extraneous characters in character constant ignored}} +wchar_t j = L'\U0010FFFD'; + +char32_t k = U'\U0010FFFD'; + +char l = 'Ø'; // expected-error {{character too large for enclosing character literal type}} +char m = '👿'; // expected-error {{character too large for enclosing character literal type}} + +char32_t n = U'ab'; // expected-error {{Unicode character literals may not contain multiple characters}} +char16_t o = '👽'; // expected-error {{character too large for enclosing character literal type}} diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c index 013103b..2903885 100644 --- a/test/Lexer/constants.c +++ b/test/Lexer/constants.c @@ -66,4 +66,4 @@ double t1[] = { // PR7888 double g = 1e100000000; // expected-warning {{too large}} -char h = '\u1234'; // expected-warning {{character unicode escape sequence too long for its type}} +char h = '\u1234'; // expected-error {{character too large for enclosing character literal type}} diff --git a/test/Lexer/cxx0x_keyword_as_cxx98.cpp b/test/Lexer/cxx0x_keyword_as_cxx98.cpp index d87d3dc..5d16810 100644 --- a/test/Lexer/cxx0x_keyword_as_cxx98.cpp +++ b/test/Lexer/cxx0x_keyword_as_cxx98.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -verify -fsyntax-only +// RUN: %clang_cc1 %s -verify -fsyntax-only -Wc++11-compat #define constexpr const constexpr int x = 0; diff --git a/test/Lexer/cxx0x_raw_string_delim_length.cpp b/test/Lexer/cxx0x_raw_string_delim_length.cpp index e7d5c6f..b9f6d13 100644 --- a/test/Lexer/cxx0x_raw_string_delim_length.cpp +++ b/test/Lexer/cxx0x_raw_string_delim_length.cpp @@ -1,3 +1,7 @@ -// RUN: %clang_cc1 -std=c++11 -E %s 2>&1 | grep 'error: raw string delimiter longer than 16 characters' +// RUN: %clang_cc1 -std=c++11 -verify %s -const char *str = R"abcdefghijkmnopqrstuvwxyz(abcdef)abcdefghijkmnopqrstuvwxyz"; +const char *str1 = R"(abcdef)"; // ok +const char *str2 = R"foo()foo"; // ok +const char *str3 = R"()"; // ok +// FIXME: recover better than this. +const char *str4 = R"abcdefghijkmnopqrstuvwxyz(abcdef)abcdefghijkmnopqrstuvwxyz"; // expected-error {{raw string delimiter longer than 16 characters}} expected-error {{expected expression}} diff --git a/test/Lexer/escape_newline.c b/test/Lexer/escape_newline.c index 43ba417..d0f27df 100644 --- a/test/Lexer/escape_newline.c +++ b/test/Lexer/escape_newline.c @@ -1,7 +1,11 @@ // RUN: %clang_cc1 -E -trigraphs %s | grep -- ' ->' // RUN: %clang_cc1 -E -trigraphs %s 2>&1 | grep 'backslash and newline separated by space' // RUN: %clang_cc1 -E -trigraphs %s 2>&1 | grep 'trigraph converted' +// RUN: %clang_cc1 -E -CC -trigraphs %s // This is an ugly way to spell a -> token. -??/ > + +// \ + diff --git a/test/Lexer/has_attribute.cpp b/test/Lexer/has_attribute.cpp deleted file mode 100644 index 9a58a30..0000000 --- a/test/Lexer/has_attribute.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %clang_cc1 -E %s -o - | FileCheck %s - -// CHECK: always_inline -#if __has_attribute(always_inline) -int always_inline(); -#endif - -// CHECK: no_dummy_attribute -#if !__has_attribute(dummy_attribute) -int no_dummy_attribute(); -#endif - diff --git a/test/Lexer/has_extension.c b/test/Lexer/has_extension.c index 4c322c7..3b08510 100644 --- a/test/Lexer/has_extension.c +++ b/test/Lexer/has_extension.c @@ -36,3 +36,9 @@ int has_c_alignas(); int no_c_alignas(); #endif +// Arbitrary feature to test that the extension name can be surrounded with +// double underscores. +// CHECK-PED-NONE: has_double_underscores +#if __has_extension(__c_alignas__) +int has_double_underscores(); +#endif diff --git a/test/Lexer/has_extension_cxx.cpp b/test/Lexer/has_extension_cxx.cpp index 5481b59..6ffeebd 100644 --- a/test/Lexer/has_extension_cxx.cpp +++ b/test/Lexer/has_extension_cxx.cpp @@ -39,3 +39,11 @@ int has_reference_qualified_functions(); #if __has_extension(cxx_rvalue_references) int has_rvalue_references(); #endif + +#if __has_extension(cxx_local_type_template_args) +int has_local_type_template_args(); +#else +int no_local_type_template_args(); +#endif + +// CHECK: has_local_type_template_args diff --git a/test/Lexer/has_feature_address_sanitizer.cpp b/test/Lexer/has_feature_address_sanitizer.cpp new file mode 100644 index 0000000..69acc39 --- /dev/null +++ b/test/Lexer/has_feature_address_sanitizer.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -E -faddress-sanitizer %s -o - | FileCheck --check-prefix=CHECK-ASAN %s +// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-ASAN %s + +#if __has_feature(address_sanitizer) +int AddressSanitizerEnabled(); +#else +int AddressSanitizerDisabled(); +#endif + +// CHECK-ASAN: AddressSanitizerEnabled +// CHECK-NO-ASAN: AddressSanitizerDisabled diff --git a/test/Lexer/has_feature_c1x.c b/test/Lexer/has_feature_c1x.c index ca4e9b9..c9a5f56 100644 --- a/test/Lexer/has_feature_c1x.c +++ b/test/Lexer/has_feature_c1x.c @@ -1,6 +1,15 @@ // RUN: %clang_cc1 -E -std=c1x %s -o - | FileCheck --check-prefix=CHECK-1X %s // RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s +#if __has_feature(c_atomic) +int has_atomic(); +#else +int no_atomic(); +#endif + +// CHECK-1X: has_atomic +// CHECK-NO-1X: no_atomic + #if __has_feature(c_static_assert) int has_static_assert(); #else @@ -27,3 +36,12 @@ int no_alignas(); // CHECK-1X: has_alignas // CHECK-NO-1X: no_alignas + +#if __STDC_VERSION__ > 199901L +int is_c1x(); +#else +int is_not_c1x(); +#endif + +// CHECK-1X: is_c1x +// CHECK-NO-1X: is_not_c1x diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index f2b4576..8e0222d 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -1,13 +1,22 @@ // RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s // RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s +#if __has_feature(cxx_atomic) +int has_atomic(); +#else +int no_atomic(); +#endif + +// CHECK-0X: has_atomic +// CHECK-NO-0X: no_atomic + #if __has_feature(cxx_lambdas) int has_lambdas(); #else int no_lambdas(); #endif -// CHECK-0X: no_lambdas +// CHECK-0X: has_lambdas // CHECK-NO-0X: no_lambdas @@ -31,6 +40,16 @@ int no_decltype(); // CHECK-NO-0X: no_decltype +#if __has_feature(cxx_decltype_incomplete_return_types) +int has_decltype_incomplete_return_types(); +#else +int no_decltype_incomplete_return_types(); +#endif + +// CHECK-0X: has_decltype_incomplete_return_types +// CHECK-NO-0X: no_decltype_incomplete_return_types + + #if __has_feature(cxx_auto_type) int has_auto_type(); #else @@ -79,6 +98,14 @@ int no_deleted_functions(); // CHECK-0X: has_deleted_functions // CHECK-NO-0X: no_deleted_functions +#if __has_feature(cxx_defaulted_functions) +int has_defaulted_functions(); +#else +int no_defaulted_functions(); +#endif + +// CHECK-0X: has_defaulted_functions +// CHECK-NO-0X: no_defaulted_functions #if __has_feature(cxx_rvalue_references) int has_rvalue_references(); @@ -182,3 +209,66 @@ int no_alignas(); // CHECK-0X: has_alignas // CHECK-NO-0X: no_alignas + +#if __has_feature(cxx_raw_string_literals) +int has_raw_string_literals(); +#else +int no_raw_string_literals(); +#endif + +// CHECK-0X: has_raw_string_literals +// CHECK-NO-0X: no_raw_string_literals + +#if __has_feature(cxx_unicode_literals) +int has_unicode_literals(); +#else +int no_unicode_literals(); +#endif + +// CHECK-0X: has_unicode_literals +// CHECK-NO-0X: no_unicode_literals + +#if __has_feature(cxx_constexpr) +int has_constexpr(); +#else +int no_constexpr(); +#endif + +// CHECK-0X: has_constexpr +// CHECK-NO-0X: no_constexpr + +#if __has_feature(cxx_generalized_initializers) +int has_generalized_initializers(); +#else +int no_generalized_initializers(); +#endif + +// CHECK-0X: has_generalized_initializers +// CHECK-NO-0X: no_generalized_initializers + +#if __has_feature(cxx_unrestricted_unions) +int has_unrestricted_unions(); +#else +int no_unrestricted_unions(); +#endif + +// CHECK-0X: has_unrestricted_unions +// CHECK-NO-0X: no_unrestricted_unions + +#if __has_feature(cxx_user_literals) +int has_user_literals(); +#else +int no_user_literals(); +#endif + +// CHECK-0X: has_user_literals +// CHECK-NO-0X: no_user_literals + +#if __has_feature(cxx_local_type_template_args) +int has_local_type_template_args(); +#else +int no_local_type_template_args(); +#endif + +// CHECK-0X: has_local_type_template_args +// CHECK-NO-0X: no_local_type_template_args diff --git a/test/Lexer/has_feature_modules.m b/test/Lexer/has_feature_modules.m new file mode 100644 index 0000000..6cea324 --- /dev/null +++ b/test/Lexer/has_feature_modules.m @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -E -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-OBJC-MODULES %s +// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-OBJC-MODULES %s +// RUN: %clang_cc1 -E -x c -fmodules %s -o - | FileCheck --check-prefix=CHECK-NO-OBJC-MODULES %s + +// RUN: %clang_cc1 -E -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-MODULES %s +// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-MODULES %s +// RUN: %clang_cc1 -E -x c -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-MODULES %s + +#if __has_feature(modules) +int has_modules(); +#else +int no_modules(); +#endif + +// CHECK-HAS-MODULES: has_modules +// CHECK-NO-MODULES: no_modules + +#if __has_feature(objc_modules) +int has_objc_modules(); +#else +int no_objc_modules(); +#endif + +// CHECK-HAS-OBJC-MODULES: has_objc_modules +// CHECK-NO-OBJC-MODULES: no_objc_modules diff --git a/test/Lexer/has_feature_type_traits.cpp b/test/Lexer/has_feature_type_traits.cpp index 53056a0..0c2cfa5 100644 --- a/test/Lexer/has_feature_type_traits.cpp +++ b/test/Lexer/has_feature_type_traits.cpp @@ -70,6 +70,11 @@ int is_enum(); #endif // CHECK: int is_enum(); +#if __has_feature(is_final) +int is_final(); +#endif +// CHECK: int is_final(); + #if __has_feature(is_pod) int is_pod(); #endif diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp index 23daa49..6566933 100644 --- a/test/Lexer/hexfloat.cpp +++ b/test/Lexer/hexfloat.cpp @@ -1,4 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s float f = 0x1p+1; // expected-warning{{hexadecimal floating constants are a C99 feature}} - +double e = 0x.p0; //expected-error{{hexadecimal floating constants require a significand}} +double d = 0x.2p2; // expected-warning{{hexadecimal floating constants are a C99 feature}} +float g = 0x1.2p2; // expected-warning{{hexadecimal floating constants are a C99 feature}} +double h = 0x1.p2; // expected-warning{{hexadecimal floating constants are a C99 feature}} diff --git a/test/Lexer/ms-extensions.c b/test/Lexer/ms-extensions.c index 9cd868e..377d2d5 100644 --- a/test/Lexer/ms-extensions.c +++ b/test/Lexer/ms-extensions.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s +// RUN: %clang_cc1 -fsyntax-only -verify -fms-compatibility %s __int8 x1 = 3i8; __int16 x2 = 4i16; diff --git a/test/Lexer/ms-extensions.cpp b/test/Lexer/ms-extensions.cpp new file mode 100644 index 0000000..7e18a6c --- /dev/null +++ b/test/Lexer/ms-extensions.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wreserved-user-defined-literal -fms-extensions -fms-compatibility %s + +#define bar(x) #x +const char * f() { + return "foo"bar("bar")"baz"; /*expected-warning {{identifier after literal will be treated as a reserved user-defined literal suffix in C++11}} */ +} diff --git a/test/Lexer/newline-eof-c++11.cpp b/test/Lexer/newline-eof-c++11.cpp new file mode 100644 index 0000000..3c45f28 --- /dev/null +++ b/test/Lexer/newline-eof-c++11.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wnewline-eof -verify %s + +// The following line isn't terminated, don't fix it. +void foo() {}
\ No newline at end of file diff --git a/test/Lexer/newline-eof-c++98-compat.cpp b/test/Lexer/newline-eof-c++98-compat.cpp new file mode 100644 index 0000000..7f7eebb --- /dev/null +++ b/test/Lexer/newline-eof-c++98-compat.cpp @@ -0,0 +1,4 @@ +// RUN: %clang -cc1 -fsyntax-only -Wc++98-compat-pedantic -std=c++11 -verify %s + +// The following line isn't terminated, don't fix it. +void foo() {} // expected-warning{{C++98 requires newline at end of file}}
\ No newline at end of file diff --git a/test/Lexer/newline-eof.c b/test/Lexer/newline-eof.c index 2f95dc7..12087b2 100644 --- a/test/Lexer/newline-eof.c +++ b/test/Lexer/newline-eof.c @@ -1,5 +1,5 @@ -// RUN: %clang -fsyntax-only -Wnewline-eof -verify %s +// RUN: %clang -cc1 -fsyntax-only -Wnewline-eof -verify %s // rdar://9133072 // The following line isn't terminated, don't fix it. -void foo() {} // expected-warning{{No newline at end of file}}
\ No newline at end of file +void foo() {} // expected-warning{{no newline at end of file}}
\ No newline at end of file diff --git a/test/Lexer/rdr-6096838-2.c b/test/Lexer/rdr-6096838-2.c index 68aa5e6..e64acc9 100644 --- a/test/Lexer/rdr-6096838-2.c +++ b/test/Lexer/rdr-6096838-2.c @@ -2,4 +2,4 @@ rdar://6096838 */ -long double d = 0x0.0000003ffffffff00000p-16357L; /* expected-warning {{ hexadecimal floating constants are a C99 feature }} */ +long double d = 0x0.0000003ffffffff00000p-16357L; /* expected-warning {{hexadecimal floating constants are a C99 feature}} */ diff --git a/test/Lexer/string-literal-encoding.c b/test/Lexer/string-literal-encoding.c new file mode 100644 index 0000000..57097dc --- /dev/null +++ b/test/Lexer/string-literal-encoding.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -x c++ -std=c++0x -fsyntax-only -verify %s + +// This file should be encoded using ISO-8859-1, the string literals should +// contain the ISO-8859-1 encoding for the code points U+00C0 U+00E9 U+00EE +// U+00F5 U+00FC + +void f() { + wchar_t const *a = L"Àéîõü"; // expected-error {{illegal character encoding in string literal}} + + char16_t const *b = u"Àéîõü"; // expected-error {{illegal character encoding in string literal}} + char32_t const *c = U"Àéîõü"; // expected-error {{illegal character encoding in string literal}} + wchar_t const *d = LR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}} + char16_t const *e = uR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}} + char32_t const *f = UR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}} + + char const *g = "Àéîõü"; // expected-warning {{illegal character encoding in string literal}} + char const *h = u8"Àéîõü"; // expected-error {{illegal character encoding in string literal}} + char const *i = R"(Àéîõü)"; // expected-warning {{illegal character encoding in string literal}} +} + +void g() { + wchar_t const *a = L"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}} + + char16_t const *b = u"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}} + char32_t const *c = U"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}} + wchar_t const *d = LR"(foo Àéîõü)"; // expected-error {{illegal character encoding in string literal}} + char16_t const *e = uR"(foo Àéîõü)"; // expected-error {{illegal character encoding in string literal}} + char32_t const *f = UR"(foo Àéîõü)"; // expected-error {{illegal character encoding in string literal}} + + char const *g = "foo Àéîõü"; // expected-warning {{illegal character encoding in string literal}} + char const *h = u8"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}} + char const *i = R"(foo Àéîõü)"; // expected-warning {{illegal character encoding in string literal}} +} diff --git a/test/Lexer/string_concat.cpp b/test/Lexer/string_concat.cpp index 43782bc..7e78a63 100644 --- a/test/Lexer/string_concat.cpp +++ b/test/Lexer/string_concat.cpp @@ -2,32 +2,32 @@ void f() { - const char* a = u8"abc" u"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char* b = u8"abc" U"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char* c = u8"abc" L"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char* d = u8"abc" uR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char* e = u8"abc" UR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char* f = u8"abc" LR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char* a = u8"abc" u"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char* b = u8"abc" U"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char* c = u8"abc" L"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char* d = u8"abc" uR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char* e = u8"abc" UR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char* f = u8"abc" LR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} - const char16_t* g = u"abc" u8"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char16_t* h = u"abc" U"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char16_t* i = u"abc" L"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char16_t* j = u"abc" u8R"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char16_t* k = u"abc" UR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char16_t* l = u"abc" LR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char16_t* g = u"abc" u8"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char16_t* h = u"abc" U"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char16_t* i = u"abc" L"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char16_t* j = u"abc" u8R"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char16_t* k = u"abc" UR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char16_t* l = u"abc" LR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} - const char32_t* m = U"abc" u8"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char32_t* n = U"abc" u"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char32_t* o = U"abc" L"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char32_t* p = U"abc" u8R"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char32_t* q = U"abc" uR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const char32_t* r = U"abc" LR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char32_t* m = U"abc" u8"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char32_t* n = U"abc" u"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char32_t* o = U"abc" L"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char32_t* p = U"abc" u8R"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char32_t* q = U"abc" uR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const char32_t* r = U"abc" LR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} - const wchar_t* s = L"abc" u8"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const wchar_t* t = L"abc" u"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const wchar_t* u = L"abc" U"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const wchar_t* v = L"abc" u8R"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const wchar_t* w = L"abc" uR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} - const wchar_t* x = L"abc" UR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const wchar_t* s = L"abc" u8"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const wchar_t* t = L"abc" u"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const wchar_t* u = L"abc" U"abc"; // expected-error {{unsupported non-standard concatenation of string literals}} + const wchar_t* v = L"abc" u8R"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const wchar_t* w = L"abc" uR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} + const wchar_t* x = L"abc" UR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}} } diff --git a/test/Lexer/token-concat.cpp b/test/Lexer/token-concat.cpp new file mode 100644 index 0000000..57dbae0 --- /dev/null +++ b/test/Lexer/token-concat.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -E -std=c++11 -o - %s | FileCheck %s + +#define id(x) x +id("s")_x // CHECK: "s" _x +id(L"s")_x // CHECK: L"s" _x +id(u8"s")_x // CHECK: u8"s" _x +id(u"s")_x // CHECK: u"s" _x +id(U"s")_x // CHECK: U"s" _x +id('s')_x // CHECK: 's' _x +id(L's')_x // CHECK: L's' _x +id(u's')_x // CHECK: u's' _x +id(U's')_x // CHECK: U's' _x +id("s"_x)_y // CHECK: "s"_x _y +id(1.0_)f // CHECK: 1.0_ f +id(1.0)_f // CHECK: 1.0 _f +id(0xface+)b_count // CHECK: 0xface+ b_count +id("s")1 // CHECK: "s"1 +id("s"_x)1 // CHECK: "s"_x 1 +id(1)_2_x // CHECK: 1 _2_x diff --git a/test/Lexer/utf8-char-literal.cpp b/test/Lexer/utf8-char-literal.cpp index c4ea5fc..12b001e 100644 --- a/test/Lexer/utf8-char-literal.cpp +++ b/test/Lexer/utf8-char-literal.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -fsyntax-only -verify %s -int array0[u'ñ' == u'\xf1'? 1 : -1]; -int array1['ñ' != u'\xf1'? 1 : -1]; +int array0[u'ñ' == u'\xf1'? 1 : -1]; +int array1['\xF1' != u'\xf1'? 1 : -1]; +int array1['ñ' != u'\xf1'? 1 : -1]; // expected-error {{character too large for enclosing character literal type}} diff --git a/test/Lexer/wchar.c b/test/Lexer/wchar.c index 648a38e..de00c02 100644 --- a/test/Lexer/wchar.c +++ b/test/Lexer/wchar.c @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -fshort-wchar -verify %s void f() { - (void)L"\U00010000"; // expected-warning {{character unicode escape sequence too long for its type}} + (void)L"\U00010000"; // unicode escape produces UTF-16 sequence, so no warning - (void)L'\U00010000'; // expected-warning {{character unicode escape sequence too long for its type}} + (void)L'\U00010000'; // expected-error {{character too large for enclosing character literal type}} (void)L'ab'; // expected-warning {{extraneous characters in character constant ignored}} |