Home | History | Annotate | Download | only in Lexer
      1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -Wfour-char-constants -fsyntax-only -verify %s
      2 
      3 int a = 'ab'; // expected-warning {{multi-character character constant}}
      4 int b = '\xFF\xFF'; // expected-warning {{multi-character character constant}}
      5 int c = 'APPS'; // expected-warning {{multi-character character constant}}
      6 
      7 char d = ''; // expected-error {{character too large for enclosing character literal type}}
      8 char e = '\u2318'; // expected-error {{character too large for enclosing character literal type}}
      9 
     10 auto f = '\xE2\x8C\x98'; // expected-warning {{multi-character character constant}}
     11 
     12 char16_t g = u'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
     13 char16_t h = u'\U0010FFFD'; // expected-error {{character too large for enclosing character literal type}}
     14 
     15 wchar_t i = L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
     16 wchar_t j = L'\U0010FFFD';
     17 
     18 char32_t k = U'\U0010FFFD';
     19 
     20 char l = ''; // expected-error {{character too large for enclosing character literal type}}
     21 char m = ''; // expected-error {{character too large for enclosing character literal type}}
     22 
     23 char32_t n = U'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
     24 char16_t o = ''; // expected-error {{character too large for enclosing character literal type}}
     25 
     26 char16_t p[2] = u"\U0000FFFF";
     27 char16_t q[2] = u"\U00010000"; // expected-error {{too long}}
     28