From: jason Date: Tue, 8 Nov 2011 01:10:43 +0000 (+0000) Subject: PR c++/50848 X-Git-Tag: upstream/4.9.2~16337 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb4746c424b852960f6d46182522cad5351267e7;p=platform%2Fupstream%2Flinaro-gcc.git PR c++/50848 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Don't crash if lookup finds a non-function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181143 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 92025a9..98e0fe3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-11-07 Jason Merrill + PR c++/50848 + * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Don't crash + if lookup finds a non-function. + PR c++/50863 * parser.c (cp_parser_initializer_list): Parse C99 array designators tentatively. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 53a5358..bf2a2c6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13673,6 +13673,8 @@ tsubst_copy_and_build (tree t, if (unq != function) { tree fn = unq; + if (TREE_CODE (fn) == INDIRECT_REF) + fn = TREE_OPERAND (fn, 0); if (TREE_CODE (fn) == COMPONENT_REF) fn = TREE_OPERAND (fn, 1); if (is_overloaded_fn (fn)) @@ -13682,7 +13684,9 @@ tsubst_copy_and_build (tree t, "and no declarations were found by " "argument-dependent lookup at the point " "of instantiation", function); - if (DECL_CLASS_SCOPE_P (fn)) + if (!DECL_P (fn)) + /* Can't say anything more. */; + else if (DECL_CLASS_SCOPE_P (fn)) { inform (EXPR_LOC_OR_HERE (t), "declarations in dependent base %qT are " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c5f4118..875e099 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-11-07 Jason Merrill + PR c++/50848 + * g++.dg/template/lookup9.C: New. + PR c++/50863 * g++.dg/cpp0x/lambda/lambda-initlist1.C: New. diff --git a/gcc/testsuite/g++.dg/template/lookup9.C b/gcc/testsuite/g++.dg/template/lookup9.C new file mode 100644 index 0000000..4a1dc79 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/lookup9.C @@ -0,0 +1,10 @@ +// PR c++/50848 +// { dg-options "-fpermissive" } + +template class A {T& foo;}; +template class B: public A { + void f(){ + foo(1); // { dg-message "foo" } + } +}; +template class B;