public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR c++/48574
Date: Fri, 06 May 2011 11:13:00 -0000	[thread overview]
Message-ID: <m3iptow0gm.fsf@redhat.com> (raw)
In-Reply-To: <4DC333FF.8030106@redhat.com> (Jason Merrill's message of "Thu,	05 May 2011 19:34:23 -0400")

Jason Merrill <jason@redhat.com> writes:

> How about type_dependent_expression_p_push instead?

Like this ?  Lightly tested.  A full bootstrap and regression test is
under way.

Thanks.

gcc/cp/

	PR c++/48574 * class.c (fixed_type_or_null): Use
	type_dependent_p_push to test if the instance has a dependent
	initializer.

gcc/testsuite/

	PR c++/48574
	* g++.dg/template/dependent-expr8.C: New test case.
---
 gcc/cp/class.c                                  |    2 +-
 gcc/testsuite/g++.dg/template/dependent-expr8.C |   25 +++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/template/dependent-expr8.C

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index a67b34a..6b08a03 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5939,7 +5939,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp)
 	     itself.  */
 	  if (TREE_CODE (instance) == VAR_DECL
 	      && DECL_INITIAL (instance)
-	      && !type_dependent_expression_p (DECL_INITIAL (instance))
+	      && !type_dependent_expression_p_push (DECL_INITIAL (instance))
 	      && !htab_find (ht, instance))
 	    {
 	      tree type;
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr8.C b/gcc/testsuite/g++.dg/template/dependent-expr8.C
new file mode 100644
index 0000000..20014d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-expr8.C
@@ -0,0 +1,25 @@
+// Origin PR c++/48574
+// { dg-options "-std=c++0x" }
+// { dg-do compile }
+
+struct A
+{
+  virtual int foo();
+};
+
+void baz (int);
+
+template <typename T>
+void
+bar(T x)
+{
+  A &b = *x;
+  baz (b.foo ());
+}
+
+void
+foo()
+{
+  A a;
+  bar(&a);
+}
-- 
		Dodji

  reply	other threads:[~2011-05-06 11:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 23:15 Dodji Seketeli
2011-05-06  0:39 ` Jason Merrill
2011-05-06 11:13   ` Dodji Seketeli [this message]
2011-05-06 13:10     ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3iptow0gm.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).