diff options
-rw-r--r-- | lib/Lex/LiteralSupport.cpp | 2 | ||||
-rw-r--r-- | test/Lexer/utf8-char-literal.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index ef385a8aed..96550e6492 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -784,7 +784,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, // Is this a Universal Character Name escape? if (begin[0] != '\\') // If this is a normal character, consume it. - ResultChar = *begin++; + ResultChar = (unsigned char)*begin++; else { // Otherwise, this is an escape character. unsigned CharWidth = getCharWidth(Kind, PP.getTargetInfo()); // Check for UCN. diff --git a/test/Lexer/utf8-char-literal.cpp b/test/Lexer/utf8-char-literal.cpp new file mode 100644 index 0000000000..1dbd669cfd --- /dev/null +++ b/test/Lexer/utf8-char-literal.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -fsyntax-only -verify %s + +int array0[u'ñ' == u'\xf1'? 1 : -1]; +int array1['ñ' != u'\xf1'? 1 : -1]; |