diff mbox

PR c++/48574

Message ID 20110413142350.GK17079@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek April 13, 2011, 2:23 p.m. UTC
On Wed, Apr 13, 2011 at 10:17:25AM -0400, Jason Merrill wrote:
> On 04/13/2011 09:40 AM, Dodji Seketeli wrote:
> >+	      if (type_dependent_expression_p (DECL_INITIAL (instance)))
> >+		{
> >+		  /* The initializer is type dependent so we cannot
> >+		     determine the dynamic type of this reference.   */
> >+		  if (nonnull)
> >+		    *nonnull = 0;
> >+		  return NULL_TREE;
> >+		}
> 
> *nonnull should still be true in this case; even if we don't know
> what the reference refers to, we can still assume that it refers to
> something.  Otherwise OK.

Then


would be shorter, after that if it returns NULL_TREE.

	Jakub

Comments

Jason Merrill April 13, 2011, 2:25 p.m. UTC | #1
On 04/13/2011 10:23 AM, Jakub Jelinek wrote:
> Then
>
> --- gcc/cp/class.c.jj	2011-04-12 19:43:49.000000000 +0200
> +++ gcc/cp/class.c	2011-04-13 15:23:07.463670993 +0200
> @@ -5939,6 +5939,7 @@ fixed_type_or_null (tree instance, int *
>   	     itself.  */
>   	  if (TREE_CODE (instance) == VAR_DECL
>   	&&  DECL_INITIAL (instance)
> +	&&  !type_dependent_expression_p (DECL_INITIAL (instance))
>   	&&  !htab_find (ht, instance))
>   	    {
>   	      tree type;
>
> would be shorter, after that if it returns NULL_TREE.

Yep.

Jason
diff mbox

Patch

--- gcc/cp/class.c.jj	2011-04-12 19:43:49.000000000 +0200
+++ gcc/cp/class.c	2011-04-13 15:23:07.463670993 +0200
@@ -5939,6 +5939,7 @@  fixed_type_or_null (tree instance, int *
 	     itself.  */
 	  if (TREE_CODE (instance) == VAR_DECL
 	      && DECL_INITIAL (instance)
+	      && !type_dependent_expression_p (DECL_INITIAL (instance))
 	      && !htab_find (ht, instance))
 	    {
 	      tree type;