re PR c++/58614 ([c++11] ICE with undeclared variable in initializer list)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 16 Jan 2015 09:38:59 +0000 (09:38 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 16 Jan 2015 09:38:59 +0000 (09:38 +0000)
/cp
2015-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58614
* pt.c (unify): When BRACE_ENCLOSED_INITIALIZER_P (arg), handle
TREE_TYPE (elt) == error_mark_node.

/testsuite
2015-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58614
* g++.dg/cpp0x/auto44.C: New.

From-SVN: r219716

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

index 146d2ff5e4368dcf0cf764710a1b836633bed117..ff5fb7a16e78254ea432eb2c3a92d7e02886b6ed 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58614
+       * pt.c (unify): When BRACE_ENCLOSED_INITIALIZER_P (arg), handle
+       TREE_TYPE (elt) == error_mark_node.
+
 2015-01-15  Jan Hubicka  <hubicka@ucw.cz>
 
        PR tree-optimization/62053
index 55871e5b6db758da11b404d2c1f32b9aa83b9a79..bc2653016f3fcff8a1d671316daa0626561017c9 100644 (file)
@@ -17875,6 +17875,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
          if (!BRACE_ENCLOSED_INITIALIZER_P (elt))
            {
              tree type = TREE_TYPE (elt);
+             if (type == error_mark_node)
+               return unify_invalid (explain_p);
              /* It should only be possible to get here for a call.  */
              gcc_assert (elt_strict & UNIFY_ALLOW_OUTER_LEVEL);
              elt_strict |= maybe_adjust_types_for_deduction
index 20df864af25ba576d1fd8c1fae86fd1dda35fbe3..0c4b8eb8b5b49f6c0c9acbc588e81c5ed9d5d4a6 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58614
+       * g++.dg/cpp0x/auto44.C: New.
+
 2015-01-15  Sandra Loosemore  <sandra@codesourcery.com>
 
        PR target/59710
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto44.C b/gcc/testsuite/g++.dg/cpp0x/auto44.C
new file mode 100644 (file)
index 0000000..687f154
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/58614
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+void foo()
+{
+  i;  // { dg-error "not declared" }
+  auto j = { i };  // { dg-error "unable to deduce" }
+}