forked from OSchip/llvm-project
A class template partial specialization cannot be a friend. Fixes PR8649.
llvm-svn: 122325
This commit is contained in:
parent
7ecd19ecde
commit
ec9518be89
|
@ -474,6 +474,8 @@ def err_tagless_friend_type_template : Error<
|
|||
"friend type templates must use an elaborated type">;
|
||||
def err_no_matching_local_friend : Error<
|
||||
"no matching function found in local scope">;
|
||||
def err_partial_specialization_friend : Error<
|
||||
"partial specialization cannot be declared as a friend">;
|
||||
|
||||
def err_abstract_type_in_decl : Error<
|
||||
"%select{return|parameter|variable|field}0 type %1 is an abstract class">;
|
||||
|
|
|
@ -4087,6 +4087,12 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
|
|||
if (TemplateParams && TemplateParams->size() > 0) {
|
||||
isPartialSpecialization = true;
|
||||
|
||||
if (TUK == TUK_Friend) {
|
||||
Diag(KWLoc, diag::err_partial_specialization_friend)
|
||||
<< SourceRange(LAngleLoc, RAngleLoc);
|
||||
return true;
|
||||
}
|
||||
|
||||
// C++ [temp.class.spec]p10:
|
||||
// The template parameter list of a specialization shall not
|
||||
// contain default template argument values.
|
||||
|
|
|
@ -207,3 +207,12 @@ namespace PR7013b {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace PR8649 {
|
||||
template<typename T, typename U, unsigned N>
|
||||
struct X {
|
||||
template<unsigned M> friend class X<T, U, M>; // expected-error{{partial specialization cannot be declared as a friend}}
|
||||
};
|
||||
|
||||
X<int, float, 7> x;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue