diff options
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/MicrosoftCompatibility.cpp | 11 | ||||
-rw-r--r-- | clang/test/SemaCXX/MicrosoftExtensions.cpp | 19 |
3 files changed, 20 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 76d88c1d261..bf2ee03a0d5 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3518,7 +3518,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // To be compatible with MSVC, hex integer literals ending with the // LL or i64 suffix are always signed in Microsoft mode. if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 || - (getLangOpts().MicrosoftExt && Literal.isLongLong))) + (getLangOpts().MSVCCompat && Literal.isLongLong))) Ty = Context.LongLongTy; else if (AllowUnsigned) Ty = Context.UnsignedLongLongTy; diff --git a/clang/test/SemaCXX/MicrosoftCompatibility.cpp b/clang/test/SemaCXX/MicrosoftCompatibility.cpp index fe8e8f77acc..56608681088 100644 --- a/clang/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/clang/test/SemaCXX/MicrosoftCompatibility.cpp @@ -242,3 +242,14 @@ namespace IntToNullPtrConv { template<int N> int *get_n() { return N; } // expected-warning {{expression which evaluates to zero treated as a null pointer constant}} int *g_nullptr = get_n<0>(); // expected-note {{in instantiation of function template specialization}} } + +namespace signed_hex_i64 { +void f(long long); +void f(int); +void g() { + // This is an ambiguous call in standard C++. + // This calls f(long long) in Microsoft mode because LL is always signed. + f(0xffffffffffffffffLL); + f(0xffffffffffffffffi64); +} +} diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp index e10deadf7c7..e12dea1fb62 100644 --- a/clang/test/SemaCXX/MicrosoftExtensions.cpp +++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp @@ -158,19 +158,16 @@ void m1() { } - - - -void f(long long); -void f(int); - -int main() -{ - // This is an ambiguous call in standard C++. - // This calls f(long long) in Microsoft mode because LL is always signed. - f(0xffffffffffffffffLL); +namespace signed_hex_i64 { +void f(long long); // expected-note {{candidate function}} +void f(int); // expected-note {{candidate function}} +void g() { + // This used to be controlled by -fms-extensions, but it is now under + // -fms-compatibility. + f(0xffffffffffffffffLL); // expected-error {{call to 'f' is ambiguous}} f(0xffffffffffffffffi64); } +} // Enumeration types with a fixed underlying type. const int seventeen = 17; |