Here the testcase defines std::initializer_list as a non-template class,
so looking up its argument fails. I don't want to get into a lot of
sanity checking for the definition of initializer_list, but this seems
simple enough.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit ea126f002069e1f25aeb64b799095aeae8c01482
Author: Jason Merrill <ja...@redhat.com>
Date: Tue Jun 3 09:38:39 2014 -0400
PR c++/60848
* call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 77aa8ca..b60bab7 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist85.C b/gcc/testsuite/g++.dg/cpp0x/initlist85.C
new file mode 100644
index 0000000..0eb8e26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist85.C
@@ -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 "" }
+}