diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-01-11 12:23:00 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-01-11 12:23:00 +0000 |
commit | a15a5eede90e41ce1bf49ecc42d54895dfd86d15 (patch) | |
tree | a0d7c261f6b0e525954cd992a26c9e20b0021034 /lib/Sema/SemaExpr.cpp | |
parent | d062b604548be6e2f85f6f63a461702e5ea14115 (diff) |
In Microsoft mode, force 64 bit hex integer constants to signed type if the LL or i64 suffix is used. This MSVC behavior.
For example:
void f(long long){ printf("long long"); }
void f(unsigned long long) { printf("unsigned long long"); }
int main() {
f(0xffffffffffffffffLL);
}
Will print "long long" using MSVC.
This patch also fixes 16 compile errors related to overloading issues when parsing the MSVC 2008 C++ standard lib.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 6f2e2ace86..63afa79f2a 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2497,7 +2497,8 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok) { // Does it fit in a unsigned long long? if (ResultVal.isIntN(LongLongSize)) { // Does it fit in a signed long long? - if (!Literal.isUnsigned && ResultVal[LongLongSize-1] == 0) + if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 || + (getLangOptions().Microsoft && Literal.isLongLong))) Ty = Context.LongLongTy; else if (AllowUnsigned) Ty = Context.UnsignedLongLongTy; |