From: Reid Kleckner Date: Fri, 20 Sep 2013 17:04:25 +0000 (+0000) Subject: Use -fms-compatibility to trigger lookup into dep. bases X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09ab088dc196863e4027b98916acb98013afb10f;p=clang Use -fms-compatibility to trigger lookup into dep. bases Update the docs for -fms-extensions and -fms-compatibility to try to clarify the difference between the two. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191095 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst index 05d8f2715f..15bac1e3e7 100644 --- a/docs/UsersManual.rst +++ b/docs/UsersManual.rst @@ -1216,12 +1216,15 @@ Microsoft extensions clang has some experimental support for extensions from Microsoft Visual C++; to enable it, use the -fms-extensions command-line option. This is the default for Windows targets. Note that the support is incomplete; -enabling Microsoft extensions will silently drop certain constructs -(including ``__declspec`` and Microsoft-style asm statements). +some constructs like dllexport on classes with inline methods will be +ignored with a warning. clang has a -fms-compatibility flag that makes clang accept enough -invalid C++ to be able to parse most Microsoft headers. This flag is -enabled by default for Windows targets. +invalid C++ to be able to parse most Microsoft headers. For example, it +allows `unqualified lookup of dependent base class members +`, which is a +common compatibility issue with clang. This flag is enabled by default +for Windows targets. -fdelayed-template-parsing lets clang delay all template instantiation until the end of a translation unit. This flag is enabled by default for diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index f79ad2cc8c..674411ec06 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -484,7 +484,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // FIXME: Deal with ambiguities cleanly. - if (Found.empty() && !ErrorRecoveryLookup && !getLangOpts().MicrosoftExt) { + if (Found.empty() && !ErrorRecoveryLookup && !getLangOpts().MicrosoftMode) { // We haven't found anything, and we're not recovering from a // different kind of error, so look for typos. DeclarationName Name = Found.getLookupName(); @@ -644,7 +644,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // public: // void foo() { D::foo2(); } // }; - if (getLangOpts().MicrosoftExt) { + if (getLangOpts().MicrosoftMode) { DeclContext *DC = LookupCtx ? LookupCtx : CurContext; if (DC->isDependentContext() && DC->isFunctionOrMethod()) { SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); diff --git a/test/SemaTemplate/lookup-dependent-bases.cpp b/test/SemaTemplate/lookup-dependent-bases.cpp index 4fcfbd1964..61fca4a2a4 100644 --- a/test/SemaTemplate/lookup-dependent-bases.cpp +++ b/test/SemaTemplate/lookup-dependent-bases.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s +// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s // expected-no-diagnostics class C {