diff options
author | Jason Merrill <jason@redhat.com> | 2010-07-06 15:23:01 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-07-06 15:23:01 -0400 |
commit | 0060a10ae887561aef22299f92098d04aee1cf14 (patch) | |
tree | d64ac9cc0dac904811ecc28e85ffa1103ecc83de | |
parent | 627bc9388801cc03a5c377850870e9e94432db29 (diff) | |
download | gcc-0060a10ae887561aef22299f92098d04aee1cf14.zip gcc-0060a10ae887561aef22299f92098d04aee1cf14.tar.gz gcc-0060a10ae887561aef22299f92098d04aee1cf14.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/call.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist41.C | 14 |
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 499bd0d..8390f2a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 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. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c4f3e95..0bf7b8e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b840179..6fc6b3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 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. diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist41.C b/gcc/testsuite/g++.dg/cpp0x/initlist41.C new file mode 100644 index 0000000..b538548 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist41.C @@ -0,0 +1,14 @@ +// 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}) ; +} + |