diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 5cd54975055d..004e6755e5f5 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -375,7 +375,7 @@ NumericLiteralParser(const char *begin, const char *end, continue; // Success. case 'i': if (PP.getLangOptions().Microsoft) { - if (isFPConstant || isUnsigned || isLong || isLongLong) break; + if (isFPConstant || isLong || isLongLong) break; // Allow i8, i16, i32, i64, and i128. if (s + 1 != ThisTokEnd) { diff --git a/clang/test/Lexer/constants-ms.c b/clang/test/Lexer/constants-ms.c index 5b3f82611977..02d5594d5bdb 100644 --- a/clang/test/Lexer/constants-ms.c +++ b/clang/test/Lexer/constants-ms.c @@ -7,6 +7,19 @@ __int64 x5 = 0x42i64; __int64 x4 = 70000000i128; __int64 y = 0x42i64u; // expected-error {{invalid suffix}} -__int64 w = 0x43ui64; // expected-error {{invalid suffix}} +__int64 w = 0x43ui64; __int64 z = 9Li64; // expected-error {{invalid suffix}} __int64 q = 10lli64; // expected-error {{invalid suffix}} + +// radar 7562363 +#define ULLONG_MAX 0xffffffffffffffffui64 +#define UINT 0xffffffffui32 +#define USHORT 0xffffui8 +#define UCHAR 0xffffffffui8 + +void a() { + unsigned long long m = ULLONG_MAX; + unsigned int n = UINT; + unsigned short s = USHORT; + unsigned char c = UCHAR; +}