forked from OSchip/llvm-project
Disallow function template partial specializations, from Hans
Wennborg! Fixes PR8295. llvm-svn: 124135
This commit is contained in:
parent
0f124e1987
commit
a5f6f9c7a1
|
@ -1683,6 +1683,8 @@ def err_function_template_spec_ambiguous : Error<
|
|||
"arguments to identify a particular function template">;
|
||||
def note_function_template_spec_matched : Note<
|
||||
"function template matches specialization %0">;
|
||||
def err_function_template_partial_spec : Error<
|
||||
"function template partial specialization is not allowed">;
|
||||
|
||||
// C++ Template Instantiation
|
||||
def err_template_recursion_depth_exceeded : Error<
|
||||
|
|
|
@ -3836,8 +3836,10 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
|||
HasExplicitTemplateArgs = true;
|
||||
|
||||
if (FunctionTemplate) {
|
||||
// FIXME: Diagnose function template with explicit template
|
||||
// arguments.
|
||||
// Function template with explicit template arguments.
|
||||
Diag(D.getIdentifierLoc(), diag::err_function_template_partial_spec)
|
||||
<< SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc);
|
||||
|
||||
HasExplicitTemplateArgs = false;
|
||||
} else if (!isFunctionTemplateSpecialization &&
|
||||
!D.getDeclSpec().isFriendSpecified()) {
|
||||
|
|
|
@ -41,3 +41,8 @@ namespace PR5833 {
|
|||
}
|
||||
template <> bool PR5833::f0<float>(float &t1) {}
|
||||
|
||||
// PR8295
|
||||
namespace PR8295 {
|
||||
template <typename T> void f(T t) {}
|
||||
template <typename T> void f<T*>(T* t) {} // expected-error{{function template partial specialization is not allowed}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue