Only apply this exception on a type that we're able to check.
rdar://
41903969
Differential revision: https://reviews.llvm.org/D49868
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338089
91177308-0d34-0410-b5e6-
96231b3b80d8
Expr *E = ListInit->getInit(0);
auto *RD = E->getType()->getAsCXXRecordDecl();
if (!isa<InitListExpr>(E) && RD &&
+ isCompleteType(Kind.getLocation(), E->getType()) &&
isOrIsDerivedFromSpecializationOf(RD, Template))
TryListConstructors = false;
}
};
}
+namespace rdar41903969 {
+template <class T> struct A {};
+template <class T> struct B;
+template <class T> struct C {
+ C(A<T>&);
+ C(B<T>&);
+};
+
+void foo(A<int> &a, B<int> &b) {
+ (void)C{b};
+ (void)C{a};
+}
+
+template<typename T> struct X {
+ X(std::initializer_list<T>) = delete;
+ X(const X&);
+};
+
+template <class T> struct D : X<T> {};
+
+void bar(D<int>& d) {
+ (void)X{d};
+}
+}
+
#else
// expected-no-diagnostics