// RUN: clang-cc -std=c++0x -fsyntax-only -verify %s
// XFAIL

// This file contains tests for n2170 that fail due to interactions with
// features that have not yet been implemented.
// i/   UCNs in identifiers
// ii/  UCNs in character constants
// iii/ C++0x Unicode character types

// note: unicode character types not yet supported
char16_t const * bad_c16lit1 = u"\u33"; // expected-error{{incomplete universal character name}}
char16_t const * bad_c16lit2 = u"\U0033"; // expected-error{{incomplete universal character name}}
char16_t const * bad_c16lit3 = u"\uD833"; // expected-error{{invalid universal character}}
char16_t const * bad_c16lit4 = u"\U0000d833"; // expected-error{{invalid universal character}}

char32_t const * bad_c32lit1 = U"\u33"; // expected-error{{incomplete universal character name}}
char32_t const * bad_c32lit2 = U"\U0033"; // expected-error{{incomplete universal character name}}
char32_t const * bad_c32lit3 = U"\uD833"; // expected-error{{invalid universal character}}
char32_t const * bad_c32lit4 = U"\U0000d833"; // expected-error{{invalid universal character}}

// C++0x supports a wider range of UCNs than C++98/03 or C99.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html
char16_t const * c16lit1 = u"\u0033";
char16_t const * c16lit2 = u"\u0015";
char16_t const * c16lit3 = u"\U00000033";
char16_t const * c16lit4 = u"\U00000015";

char32_t const * c32lit1 = U"\u0033";
char32_t const * c32lit2 = U"\u0015";
char32_t const * c32lit3 = U"\U00000033";
char32_t const * c32lit4 = U"\U00000015";


// Note: UCNs are not yet supported for character literals.
// Opening a core issue for when a UCN cannot be represented by a single char.
char const bad_char1 = '\u33'; // expected-error{{incomplete universal character name}}
char const bad_char2 = '\ud8aA'; // expected-error{{invalid universal character}}
char const bad_char3 = '\U0033'; // expected-error{{incomplete universal character name}}
char const bad_char4 = '\U0000D8Aa'; // expected-error{{expected-error{{invalid universal character}}

wchar_t const bad_wchar_t1 = L'\u33'; // expected-error{{incomplete universal character name}}
wchar_t const bad_wchar_t2 = L'\ud8aA'; // expected-error{{invalid universal character}}
wchar_t const bad_wchar_t3 = L'\U0033'; // expected-error{{incomplete universal character name}}
wchar_t const bad_wchar_t4 = L'\U0000D8Aa'; // expected-error{{invalid universal character}}

// Note: Unicode char types not yet supported.
char16_t const bad_char16_t1 = u'\u33'; // expected-error{{incomplete universal character name}}
char16_t const bad_char16_t2 = u'\ud8aA'; // expected-error{{invalid universal character}}
char16_t const bad_char16_t3 = u'\U0033'; // expected-error{{incomplete universal character name}}
char16_t const bad_char16_t4 = u'\U0000D8Aa'; // expected-error{{invalid universal character}}

char32_t const bad_char32_t1 = U'\u33'; // expected-error{{incomplete universal character name}}
char32_t const bad_char32_t2 = U'\ud8aA'; // expected-error{{invalid universal character}}
char32_t const bad_char32_t3 = U'\U0033'; // expected-error{{incomplete universal character name}}
char32_t const bad_char32_t4 = U'\U0000D8Aa'; // expected-error{{invalid universal character}}


// C++0x supports a wider range of UCNs than C++98/03 or C99.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html
char const char_lit1 = '\u0033';
char const char_lit2 = '\u000a';
char const char_lit3 = '\U00000033';
char const char_lit4 = '\U0000000A';

wchar_t const wchar_t_lit1 = L'\u0033';
wchar_t const wchar_t_lit2 = L'\u000a';
wchar_t const wchar_t_lit3 = L'\U00000033';
wchar_t const wchar_t_lit4 = L'\U0000000A';

char16_t const char16_t_lit1 = u'\u0033';
char16_t const char16_t_lit2 = u'\u000a';
char16_t const char16_t_lit3 = u'\U00000033';
char16_t const char16_t_lit4 = u'\U0000000A';

char32_t const char32_t_lit1 = U'\u0033';
char32_t const char32_t_lit2 = U'\u000a';
char32_t const char32_t_lit3 = U'\U00000033';
char32_t const char32_t_lit4 = U'\U0000000A';


static_assert (char_lit1 == '3', "UCN should evaluate to '3'");
static_assert (char_lit2 == '\n', "UCN should evaluate to '\n'");
static_assert (char_lit3 == '3', "UCN should evaluate to '3'");
static_assert (char_lit4 == '\n', "UCN should evaluate to '\n'");

static_assert (wchar_t_lit1 == L'3', "UCN should evaluate to '3'");
static_assert (wchar_t_lit2 == L'\n', "UCN should evaluate to '\n'");
static_assert (wchar_t_lit3 == L'3', "UCN should evaluate to '3'");
static_assert (wchar_t_lit4 == L'\n', "UCN should evaluate to '\n'");

static_assert (char16_t_lit1 == u'3', "UCN should evaluate to '3'");
static_assert (char16_t_lit2 == u'\n', "UCN should evaluate to '\n'");
static_assert (char16_t_lit3 == u'3', "UCN should evaluate to '3'");
static_assert (char16_t_lit4 == u'\n', "UCN should evaluate to '\n'");

static_assert (char32_t_lit1 == U'3', "UCN should evaluate to '3'");
static_assert (char32_t_lit2 == U'\n', "UCN should evaluate to '\n'");
static_assert (char32_t_lit3 == U'3', "UCN should evaluate to '3'");
static_assert (char32_t_lit4 == U'\n', "UCN should evaluate to '\n'");


// UCNs in identifiers are not yet supported.
int ident\u15; // expected-error{{incomplete universal character name}}
int identU\U0015; // expected-error{{incomplete universal character name}}

// Confirm the extra character supported inside literals are not valid identifiers
int ident\u0024\u0040\u0060; // expected-error{{invalid token after top level declarator}}
int ident\u0015; // expected-error{{invalid universal character}}
int ident\u0033; // expected-error{{invalid universal character}}
int ident\ud833; // expected-error{{invalid universal character}}

int identU\U00000024\U00000040\U00000060; // expected-error{{invalid token after top level declarator}}
int identU\U00000015; // expected-error{{invalid universal character}}
int identU\U00000033; // expected-error{{invalid universal character}}
int identU\U0000D833; // expected-error{{invalid universal character}}


// UCNs in macro identifiers are not yet supported.
#define macro\u15; // expected-error{{incomplete universal character name}}
#define macroU\U0015; // expected-error{{incomplete universal character name}}

// Confirm the extra character supported inside literals are not valid identifiers
#define macro\u0024\u0040\u0060; // expected-error{{invalid token after top level declarator}}
#define macro\u0015; // expected-error{{invalid universal character}}
#define macro\u0033; // expected-error{{invalid universal character}}
#define macro\uD833; // expected-error{{invalid universal character}}

#define macroU\U00000024\U00000040\U00000060; // expected-error{{invalid token after top level declarator}}
#define macroU\U00000015; // expected-error{{invalid universal character}}
#define macroU\U00000033; // expected-error{{invalid universal character}}
#define macroU\U0000d833; // expected-error{{invalid universal character}}
