Revert 131347. It asserts if the specialization in within a class template:
template<class U>
struct X1 {
template<class T> void f(T*);
template<> void f(int*) { }
};
Won't be so simple. I need to think more about it.
llvm-svn: 131362
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 25d2358..9385732 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1685,14 +1685,10 @@
if (OldMethod && NewMethod) {
// Preserve triviality.
NewMethod->setTrivial(OldMethod->isTrivial());
-
- // MSVC allows explicit template specialization at class scope.
- bool IsMSExplicitSpecialization = getLangOptions().Microsoft &&
- NewMethod->isFunctionTemplateSpecialization();
+
bool isFriend = NewMethod->getFriendObjectKind();
- if (!isFriend && NewMethod->getLexicalDeclContext()->isRecord() &&
- !IsMSExplicitSpecialization) {
+ if (!isFriend && NewMethod->getLexicalDeclContext()->isRecord()) {
// -- Member function declarations with the same name and the
// same parameter types cannot be overloaded if any of them
// is a static member function declaration.
@@ -4573,7 +4569,7 @@
NewFD->setInvalidDecl();
} else if (isFunctionTemplateSpecialization) {
if (CurContext->isDependentContext() && CurContext->isRecord()
- && !isFriend) {
+ && !isFriend && !getLangOptions().Microsoft) {
Diag(NewFD->getLocation(), diag::err_function_specialization_in_class)
<< NewFD->getDeclName();
NewFD->setInvalidDecl();