From de37b21e3d945ed6a0bf032078c233854ff38c8e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 16 Jan 2015 09:38:59 +0000 Subject: [PATCH] re PR c++/58614 ([c++11] ICE with undeclared variable in initializer list) /cp 2015-01-16 Paolo Carlini 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 PR c++/58614 * g++.dg/cpp0x/auto44.C: New. From-SVN: r219716 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/auto44.C | 10 ++++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto44.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 146d2ff5e43..ff5fb7a16e7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-01-16 Paolo Carlini + + PR c++/58614 + * pt.c (unify): When BRACE_ENCLOSED_INITIALIZER_P (arg), handle + TREE_TYPE (elt) == error_mark_node. + 2015-01-15 Jan Hubicka PR tree-optimization/62053 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 55871e5b6db..bc2653016f3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20df864af25..0c4b8eb8b5b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-16 Paolo Carlini + + PR c++/58614 + * g++.dg/cpp0x/auto44.C: New. + 2015-01-15 Sandra Loosemore 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 index 00000000000..687f154a095 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto44.C @@ -0,0 +1,10 @@ +// PR c++/58614 +// { dg-do compile { target c++11 } } + +#include + +void foo() +{ + i; // { dg-error "not declared" } + auto j = { i }; // { dg-error "unable to deduce" } +} -- 2.30.2