Don't complain about useless user-defined conversion functions when
they were instantiated from a template. In template metaprogramming, stuff happens. Fixes PR8065. llvm-svn: 113722
This commit is contained in:
parent
fd26915742
commit
6309e3d18e
|
@ -3233,7 +3233,10 @@ Decl *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
|
|||
= Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
|
||||
if (const ReferenceType *ConvTypeRef = ConvType->getAs<ReferenceType>())
|
||||
ConvType = ConvTypeRef->getPointeeType();
|
||||
if (ConvType->isRecordType()) {
|
||||
if (Conversion->getTemplateSpecializationKind() != TSK_Undeclared &&
|
||||
Conversion->getTemplateSpecializationKind() != TSK_ExplicitSpecialization)
|
||||
/* Suppress disanogstics for instantiations. */;
|
||||
else if (ConvType->isRecordType()) {
|
||||
ConvType = Context.getCanonicalType(ConvType).getUnqualifiedType();
|
||||
if (ConvType == ClassType)
|
||||
Diag(Conversion->getLocation(), diag::warn_conv_to_self_not_used)
|
||||
|
|
|
@ -325,3 +325,21 @@ namespace rdar8018274 {
|
|||
int i = ed;
|
||||
}
|
||||
}
|
||||
|
||||
namespace PR8065 {
|
||||
template <typename T> struct Iterator;
|
||||
template <typename T> struct Container;
|
||||
|
||||
template<>
|
||||
struct Iterator<int> {
|
||||
typedef Container<int> container_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Container {
|
||||
typedef typename Iterator<T>::container_type X;
|
||||
operator X(void) { return X(); }
|
||||
};
|
||||
|
||||
Container<int> test;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue