From: Paolo Carlini Date: Fri, 2 Jul 2010 10:13:21 +0000 (+0000) Subject: re PR c++/44039 (ICE: Segmentation fault on error recovery) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=baf7c318bbcad3acee65f8400c34665b9345f09a;p=gcc.git re PR c++/44039 (ICE: Segmentation fault on error recovery) /cp 2010-07-02 Paolo Carlini PR c++/44039 * pt.c (tsubst_baselink): Return error_mark_node if lookup_fnfields returns NULL_TREE. /testsuite 2010-07-02 Paolo Carlini PR c++/44039 * g++.dg/template/crash101.C: New. From-SVN: r161698 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 27e7f7a5ff3..3b2764d9ae2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-07-02 Paolo Carlini + + PR c++/44039 + * pt.c (tsubst_baselink): Return error_mark_node if lookup_fnfields + returns NULL_TREE. + 2010-07-01 Richard Guenther * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 09d077ade06..79142b9ff07 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10737,6 +10737,8 @@ tsubst_baselink (tree baselink, tree object_type, if (IDENTIFIER_TYPENAME_P (name)) name = mangle_conv_op_name_for_type (optype); baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1); + if (!baselink) + return error_mark_node; /* If lookup found a single function, mark it as used at this point. (If it lookup found multiple functions the one selected diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4dc10bc2ce..c1a291d5716 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-07-02 Paolo Carlini + + PR c++/44039 + * g++.dg/template/crash101.C: New. + 2010-07-02 Iain Sandoe * obj-c++.dg/cxx-ivars-3.mm: Make the test require OSX <= 10.4. diff --git a/gcc/testsuite/g++.dg/template/crash101.C b/gcc/testsuite/g++.dg/template/crash101.C new file mode 100644 index 00000000000..38059fc5e76 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash101.C @@ -0,0 +1,12 @@ +// PR c++/44039 + +struct locale { }; + +template + void + foo() + { locale::locale(); } // // { dg-error "cannot call|function-style" } + +void +bar() +{ foo(); }