forked from OSchip/llvm-project
Revert r127206 "Detect attempts to provide a specialization of a function within
a...", it appears to cause us to reject various valid codes. llvm-svn: 127373
This commit is contained in:
parent
a319876559
commit
334b2136f6
|
@ -1723,8 +1723,6 @@ def err_template_spec_default_arg : Error<
|
||||||
def err_not_class_template_specialization : Error<
|
def err_not_class_template_specialization : Error<
|
||||||
"cannot specialize a %select{dependent template|template template "
|
"cannot specialize a %select{dependent template|template template "
|
||||||
"parameter}0">;
|
"parameter}0">;
|
||||||
def err_function_specialization_in_class : Error<
|
|
||||||
"cannot specialize a function %0 within class scope">;
|
|
||||||
|
|
||||||
// C++ class template specializations and out-of-line definitions
|
// C++ class template specializations and out-of-line definitions
|
||||||
def err_template_spec_needs_header : Error<
|
def err_template_spec_needs_header : Error<
|
||||||
|
|
|
@ -4083,14 +4083,9 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||||
Previous))
|
Previous))
|
||||||
NewFD->setInvalidDecl();
|
NewFD->setInvalidDecl();
|
||||||
} else if (isFunctionTemplateSpecialization) {
|
} else if (isFunctionTemplateSpecialization) {
|
||||||
if (CurContext->isDependentContext() && CurContext->isRecord()) {
|
if (CheckFunctionTemplateSpecialization(NewFD,
|
||||||
Diag(NewFD->getLocation(), diag::err_function_specialization_in_class)
|
(HasExplicitTemplateArgs ? &TemplateArgs : 0),
|
||||||
<< NewFD->getDeclName();
|
Previous))
|
||||||
NewFD->setInvalidDecl();
|
|
||||||
return 0;
|
|
||||||
} else if (CheckFunctionTemplateSpecialization(NewFD,
|
|
||||||
(HasExplicitTemplateArgs ? &TemplateArgs : 0),
|
|
||||||
Previous))
|
|
||||||
NewFD->setInvalidDecl();
|
NewFD->setInvalidDecl();
|
||||||
} else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD)) {
|
} else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD)) {
|
||||||
if (CheckMemberSpecialization(NewFD, Previous))
|
if (CheckMemberSpecialization(NewFD, Previous))
|
||||||
|
|
|
@ -237,15 +237,3 @@ void test_func_template(N0::X0<void *> xvp, void *vp, const void *cvp,
|
||||||
xvp.ft1(vp, i);
|
xvp.ft1(vp, i);
|
||||||
xvp.ft1(vp, u);
|
xvp.ft1(vp, u);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PR8979 {
|
|
||||||
template<typename Z>
|
|
||||||
struct X0 {
|
|
||||||
template <class T, class U> class Inner;
|
|
||||||
struct OtherInner;
|
|
||||||
template<typename T, typename U> void f(Inner<T, U>&);
|
|
||||||
|
|
||||||
typedef Inner<OtherInner, OtherInner> MyInner;
|
|
||||||
template<> void f(MyInner&); // expected-error{{cannot specialize a function 'f' within class scope}}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue