Index: include/clang/AST/ASTContext.h =================================================================== --- include/clang/AST/ASTContext.h +++ include/clang/AST/ASTContext.h @@ -1126,7 +1126,7 @@ /// Retrieve the declaration for the 128-bit unsigned integer type. TypedefDecl *getUInt128Decl() const; - /// Retrieve the declaration for the type_info class type. + /// Retrieve the declaration for the MSVC ::type_info class type. RecordDecl *getTypeInfoClassDecl() const; //===--------------------------------------------------------------------===// Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -1081,8 +1081,10 @@ } RecordDecl *ASTContext::getTypeInfoClassDecl() const { - if (!TypeInfoClassDecl) + if (!TypeInfoClassDecl) { TypeInfoClassDecl = buildImplicitRecord("type_info", TTK_Class); + TypeInfoClassDecl->setModuleOwnershipKind(Decl::ModuleOwnershipKind::Unowned); + } return TypeInfoClassDecl; } Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -1464,11 +1464,6 @@ if (NewM == OldM) return false; - // FIXME: The Modules TS does not specify how to handle inplicit types - // For now we will simply ignore the implicit global types - if (Old->isImplicit()) - return false; - // FIXME: Check proclaimed-ownership-declarations here too. bool NewIsModuleInterface = NewM && NewM->Kind == Module::ModuleInterfaceUnit; bool OldIsModuleInterface = OldM && OldM->Kind == Module::ModuleInterfaceUnit; Index: test/Modules/msvc-compat-implitic-types.cpp =================================================================== --- /dev/null +++ test/Modules/msvc-compat-implitic-types.cpp @@ -0,0 +1,14 @@ +// Verify there is not collision between the +// RUN: %clang -fms-compatibility -fmodules-ts -x c++-module --precompile -DEXPORT -o %t.pcm %s +// RUN: %clang -fms-compatibility -fmodules-ts -fmodule-file=%t.pcm -c -DMAIN %s + +// expected-no-diagnostics + +#if EXPORT +export module MyModule; +export class MyClass {}; +#elif MAIN +#include +#else +#error MISSING DEFINE +#endif \ No newline at end of file