diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fae8da1fb25..2ed9f15c366 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-03 Jason Merrill + + PR c++/60848 + * call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO. + 2014-06-02 Jason Merrill PR c++/61046 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 77aa8caf678..b60bab775cd 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 00000000000..0eb8e26b8cf --- /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 "" } +}