OSDN Git Service

PR c++/44703
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jul 2010 19:23:01 +0000 (19:23 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jul 2010 19:23:01 +0000 (19:23 +0000)
* call.c (is_std_init_list): Look through typedefs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161880 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist41.C [new file with mode: 0644]

index 499bd0d..8390f2a 100644 (file)
@@ -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.
index c4f3e95..0bf7b8e 100644 (file)
@@ -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);
index b840179..6fc6b3b 100644 (file)
@@ -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 (file)
index 0000000..b538548
--- /dev/null
@@ -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}) ;
+}
+