This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/48707 (c++0x ice on initialization in template)
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 13 Aug 2012 14:19:50 -0700
- Subject: Re: C++ PATCH for c++/48707 (c++0x ice on initialization in template)
- References: <4DB5ED5E.1040700@redhat.com>
On Mon, Apr 25, 2011 at 2:53 PM, Jason Merrill <jason@redhat.com> wrote:
> In C++0x we can have an initializer that is potentially constant and yet
> still type-dependent if it involves a call, so we need to handle that.
>
> For 4.7 I'm explicitly testing for type-dependency; for 4.6 I've made a
> smaller change to make value_dependent_expression_p return true for
> type-dependent expressions as well.
>
> commit 6b978a4d2e33771d8fd95f39a301f8df180ac98c
> Author: Jason Merrill <jason@redhat.com>
> Date: Mon Apr 25 16:44:03 2011 -0400
>
> PR c++/48707
> * pt.c (value_dependent_expression_p): Handle type-dependent
> expression.
>
> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
> index ed48203..fc5177d 100644
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -18068,6 +18068,11 @@ value_dependent_expression_p (tree expression)
> if (DECL_P (expression) && type_dependent_expression_p (expression))
> return true;
>
> + /* We shouldn't have gotten here for a type-dependent expression, but
> + let's handle it properly anyway. */
> + if (TREE_TYPE (expression) == NULL_TREE)
> + return true;
> +
> switch (TREE_CODE (expression))
> {
> case IDENTIFIER_NODE:
Any particular reason why it was only applied to 4.6 branch?
The same patch also fixes:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53836
on trunk which is a regression from 4.6.
--
H.J.