From 1af37cb5ed36b62f2d16256d13f23f1446d3fcc0 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Sun, 5 Jan 2014 06:38:18 +0000 Subject: [PATCH] Pre-declare '::type_info' in MicrosoftMode only, not MicrosoftExt It was previously enabled in both but should only have been part of the drop-in quirks mode that is 'MicrosoftMode' given that it's only useful for compatibility with the Microsoft headers/runtime. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198548 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/Sema.cpp | 2 +- test/SemaCXX/MicrosoftCompatibility.cpp | 5 +++++ test/SemaCXX/MicrosoftExtensions.cpp | 4 ---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 35fd86fd25..1c748f61e0 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -179,7 +179,7 @@ void Sema::Initialize() { } // Initialize Microsoft "predefined C++ types". - if (PP.getLangOpts().MicrosoftExt && PP.getLangOpts().CPlusPlus) { + if (PP.getLangOpts().MicrosoftMode && PP.getLangOpts().CPlusPlus) { if (IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end()) PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class), TUScope); diff --git a/test/SemaCXX/MicrosoftCompatibility.cpp b/test/SemaCXX/MicrosoftCompatibility.cpp index 05037ac6a0..3097b7da10 100644 --- a/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/test/SemaCXX/MicrosoftCompatibility.cpp @@ -21,6 +21,11 @@ void test() } +namespace ms_predefined_types { + // ::type_info is predeclared with forward class declartion + void f(const type_info &a); +} + namespace ms_protected_scope { struct C { C(); }; diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp index 32b8adb5df..6f90b6ae7c 100644 --- a/test/SemaCXX/MicrosoftExtensions.cpp +++ b/test/SemaCXX/MicrosoftExtensions.cpp @@ -1,10 +1,6 @@ // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -// ::type_info is predeclared with forward class declartion -void f(const type_info &a); - - // Microsoft doesn't validate exception specification. namespace microsoft_exception_spec { -- 2.50.0