commit ea126f002069e1f25aeb64b799095aeae8c01482
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jun 3 09:38:39 2014 -0400
PR c++/60848
* call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO.
@@ -9675,6 +9675,7 @@ is_std_init_list (tree type)
type = TYPE_MAIN_VARIANT (type);
return (CLASS_TYPE_P (type)
&& CP_TYPE_CONTEXT (type) == std_node
+ && CLASSTYPE_TEMPLATE_INFO (type)
&& strcmp (TYPE_NAME_STRING (type), "initializer_list") == 0);
}
new file mode 100644
@@ -0,0 +1,14 @@
+// PR c++/60848
+// { dg-do compile { target c++11 } }
+
+namespace std
+{
+ struct initializer_list {};
+}
+
+void foo(std::initializer_list &);
+
+void f()
+{
+ foo({1, 2}); // { dg-error "" }
+}