From: Jason Merrill Date: Fri, 21 Feb 2014 21:43:29 +0000 (-0500) Subject: re PR c++/59347 (ICE on invalid: tree check: expected class 'type', have 'exceptional... X-Git-Tag: upstream/12.2.0~64576 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71b735a54005a9b4bd41df990673a6310c332d58;p=platform%2Fupstream%2Fgcc.git re PR c++/59347 (ICE on invalid: tree check: expected class 'type', have 'exceptional' (error_mark) in tsubst_decl, at cp/pt.c:10798) PR c++/59347 * pt.c (tsubst_decl) [TYPE_DECL]: Don't try to instantiate an erroneous typedef. From-SVN: r208025 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 01a2569..1fcf54d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-02-21 Jason Merrill + PR c++/59347 + * pt.c (tsubst_decl) [TYPE_DECL]: Don't try to instantiate an + erroneous typedef. + PR c++/60241 * pt.c (lookup_template_class_1): Update DECL_TEMPLATE_INSTANTIATIONS of the partial instantiation, not the most general template. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 91a8840..2dc5f32 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10824,6 +10824,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) tree type = NULL_TREE; bool local_p; + if (TREE_TYPE (t) == error_mark_node) + RETURN (error_mark_node); + if (TREE_CODE (t) == TYPE_DECL && t == TYPE_MAIN_DECL (TREE_TYPE (t))) { diff --git a/gcc/testsuite/g++.dg/template/typedef41.C b/gcc/testsuite/g++.dg/template/typedef41.C new file mode 100644 index 0000000..dc25518 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef41.C @@ -0,0 +1,8 @@ +// PR c++/59347 + +template struct A +{ + typedef int ::X; // { dg-error "" } +}; + +A<0> a;