re PR c++/60848 (Crash while experimenting with c++-0x initializer lists)

PR c++/60848
	* call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO.

From-SVN: r211179
This commit is contained in:
Jason Merrill 2014-06-03 10:11:10 -04:00 committed by Jason Merrill
parent 616abc647c
commit 010bc40a6c
3 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2014-06-03 Jason Merrill <jason@redhat.com>
PR c++/60848
* call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO.
2014-06-02 Jason Merrill <jason@redhat.com>
PR c++/61046

View file

@ -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);
}

View file

@ -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 "" }
}