Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -3562,7 +3562,14 @@ } } - if (OldQTypeForComparison == NewQType) + if (OldQTypeForComparison == NewQType || + // In Microsoft compatibility mode, the intent is to only warn on + // mismatched exception specifiers. By this point, that warning has + // already been issued, so we should treat mismatches only in exception + // specifier as equivalent. + (getLangOpts().MSVCCompat && + Context.hasSameFunctionTypeIgnoringExceptionSpec(OldQTypeForComparison, + NewQType))) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); // If the types are imprecise (due to dependent constructs in friends or Index: test/SemaCXX/ms-ignore-mismatched-except-specifier.cpp =================================================================== --- /dev/null +++ test/SemaCXX/ms-ignore-mismatched-except-specifier.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -std=c++1z -fms-extensions -fms-compatibility + +template struct FooPtr { + template FooPtr(U *p) : m_pT(nullptr) {} + template <> FooPtr(T *pInterface) throw() : m_pT(pInterface) {} // expected-warning {{exception specification in declaration does not match previous declaration}} + T *m_pT; +}; +struct Bar{}; +template struct FooPtr;