My PR969626 patch made us ignore template candidates when there's a perfect
non-template candidate. In this case, we were considering B(int) a perfect
match for B({0}), but the brace elision makes it imperfect.
PR c++/100963
gcc/cp/ChangeLog:
* call.c (perfect_conversion_p): Check check_narrowing.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist124.C: New test.
next_conversion (conv)->type))
return false;
}
+ if (conv->check_narrowing)
+ /* Brace elision is imperfect. */
+ return false;
return true;
}
--- /dev/null
+// PR c++/100963
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+struct B {
+ B(int) = delete;
+ template<class T> B(std::initializer_list<T>);
+};
+
+int main() {
+ B({0});
+}