Commit 0060a10a by Jason Merrill Committed by Jason Merrill

re PR c++/44703 ([C++0x] List initialization fail if parameter is typedef name…

re PR c++/44703 ([C++0x] List initialization fail if parameter is typedef name for the std::initializer_list)

	PR c++/44703
	* call.c (is_std_init_list): Look through typedefs.

From-SVN: r161880
parent 627bc938
2010-07-06 Jason Merrill <jason@redhat.com>
PR c++/44703
* call.c (is_std_init_list): Look through typedefs.
PR c++/44778
* init.c (build_offset_ref): If scope isn't dependent,
don't exit early. Look at TYPE_MAIN_VARIANT.
......
......@@ -7953,6 +7953,10 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
bool
is_std_init_list (tree type)
{
/* Look through typedefs. */
if (!TYPE_P (type))
return false;
type = TYPE_MAIN_VARIANT (type);
return (CLASS_TYPE_P (type)
&& CP_TYPE_CONTEXT (type) == std_node
&& strcmp (TYPE_NAME_STRING (type), "initializer_list") == 0);
......
2010-07-06 Jason Merrill <jason@redhat.com>
PR c++/44703
* g++.dg/cpp0x/initlist41.C: New.
PR c++/44778
* g++.dg/template/ptrmem22.C: New.
......
// PR c++/44703
// { dg-options -std=c++0x }
#include <initializer_list>
typedef std::initializer_list<int> type ;
void f(type) {}
int main()
{
// error: could not convert '{1, 2, 3}' to 'type'
f({1,2,3}) ;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment