QualType P = Context.getCanonicalType(FromType);
QualType A = Context.getCanonicalType(ToType);
- // C++0x [temp.deduct.conv]p3:
+ // C++0x [temp.deduct.conv]p2:
// If P is a reference type, the type referred to by P is used for
// type deduction.
if (const ReferenceType *PRef = P->getAs<ReferenceType>())
P = PRef->getPointeeType();
- // C++0x [temp.deduct.conv]p3:
- // If A is a reference type, the type referred to by A is used
+ // C++0x [temp.deduct.conv]p4:
+ // [...] If A is a reference type, the type referred to by A is used
// for type deduction.
if (const ReferenceType *ARef = A->getAs<ReferenceType>())
- A = ARef->getPointeeType();
- // C++ [temp.deduct.conv]p2:
+ A = ARef->getPointeeType().getUnqualifiedType();
+ // C++ [temp.deduct.conv]p3:
//
// If A is not a reference type:
else {
else
P = P.getUnqualifiedType();
- // C++0x [temp.deduct.conv]p3:
+ // C++0x [temp.deduct.conv]p4:
// If A is a cv-qualified type, the top level cv-qualifiers of A's
- // type are ignored for type deduction.
+ // type are ignored for type deduction. If A is a reference type, the type
+ // referred to by A is used for type deduction.
A = A.getUnqualifiedType();
}
};
int x = C().operator int();
}
+
+namespace PR9336 {
+ template<class T>
+ struct generic_list
+ {
+ template<class Container>
+ operator Container()
+ {
+ Container ar;
+ T* i;
+ ar[0]=*i;
+ return ar;
+ }
+ };
+
+ template<class T>
+ struct array
+ {
+ T& operator[](int);
+ const T& operator[](int)const;
+ };
+
+ generic_list<generic_list<int> > l;
+ array<array<int> > a = l;
+}