When performing template argument deduction for a non-reference
conversion function when we're binding the result to a reference, drop
cv-qualifiers on the type we're referring to, since we should be
deducing a type that can be adjusted (via cv-qualification) to the
requested type. Fixes PR9336, and the remaining Boost.Assign failure.
llvm-svn: 127117
diff --git a/clang/test/SemaCXX/conversion-function.cpp b/clang/test/SemaCXX/conversion-function.cpp
index 61c8ada..aa47ae0 100644
--- a/clang/test/SemaCXX/conversion-function.cpp
+++ b/clang/test/SemaCXX/conversion-function.cpp
@@ -353,3 +353,28 @@
};
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;
+}