From: David Majnemer Date: Wed, 18 Feb 2015 02:28:13 +0000 (+0000) Subject: Sema: size_t is available in C when -fms-compatibility is enabled X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2043f486036f77a01c0e1057ea67be8a680caf6;p=clang Sema: size_t is available in C when -fms-compatibility is enabled git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229616 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 21e86a11f5..5170c244bb 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -193,8 +193,9 @@ void Sema::Initialize() { } // Initialize Microsoft "predefined C++ types". - if (PP.getLangOpts().MSVCCompat && PP.getLangOpts().CPlusPlus) { - if (IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end()) + if (PP.getLangOpts().MSVCCompat) { + if (PP.getLangOpts().CPlusPlus && + IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end()) PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class), TUScope); diff --git a/test/Sema/MicrosoftCompatibility.c b/test/Sema/MicrosoftCompatibility.c index a193b26b42..010033bba0 100644 --- a/test/Sema/MicrosoftCompatibility.c +++ b/test/Sema/MicrosoftCompatibility.c @@ -21,3 +21,5 @@ struct __declspec(aligned) S2 {}; /* expected-warning {{__declspec attribute 'al struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */ __declspec(__noreturn__) void f7(void); /* expected-warning {{__declspec attribute '__noreturn__' is not supported}} */ + +size_t x;