From: Nathan Sidwell Date: Sun, 3 Aug 2003 14:23:34 +0000 (+0000) Subject: re PR c++/11704 (ICE in type_dependent_expression_p with wrong method call in templat... X-Git-Tag: releases/gcc-3.4.0~4415 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6cb893080b617bc70a23ba35907ea79cc8c25a80;p=thirdparty%2Fgcc.git re PR c++/11704 (ICE in type_dependent_expression_p with wrong method call in template class) cp: PR c++/11704 * pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with unknown type. testsuite: PR c++/11704 * g++.dg/template/dependent-expr2.C: New test. From-SVN: r70119 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index de0923a96cf1..a8c8a97b1c5e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2003-08-03 Nathan Sidwell + + PR c++/11704 + * pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with + unknown type. + + PR c++/11766 + * typeck.c (comp_ptr_ttypes_real): Don't loop on pointers to + member functions. + 2003-08-02 Nathan Sidwell PR c++/9447 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 185a203c2002..706691c6b6a4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11625,6 +11625,15 @@ type_dependent_expression_p (tree expression) { if (TREE_CODE (expression) == ADDR_EXPR) return type_dependent_expression_p (TREE_OPERAND (expression, 0)); + if (TREE_CODE (expression) == COMPONENT_REF) + { + if (type_dependent_expression_p (TREE_OPERAND (expression, 0))) + return true; + expression = TREE_OPERAND (expression, 1); + if (TREE_CODE (expression) == IDENTIFIER_NODE) + return false; + } + if (TREE_CODE (expression) == BASELINK) expression = BASELINK_FUNCTIONS (expression); if (TREE_CODE (expression) == TEMPLATE_ID_EXPR) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 61d9742f90dc..04c94a293e7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-08-03 Nathan Sidwell + PR c++/11704 + * g++.dg/template/dependent-expr2.C: New test. + PR c++/11766 * g++.dg/expr/ptrmem1.C: New test. diff --git a/gcc/testsuite/g++.dg/template/dependent-expr2.C b/gcc/testsuite/g++.dg/template/dependent-expr2.C new file mode 100644 index 000000000000..9c9d5f96673e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-expr2.C @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 2 Aug 2003 + +// PR 11704. ICE + +struct A +{ + int foo() + { + return 5; + } +}; + +template // If B is not template it works +struct B +{ + bool bar(A& a) + { + return a.foo == 0; // { dg-error "insufficient context" "" } + } +};