public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: Jason Merrill <jason@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch / RFC] PR 50870
Date: Wed, 26 Oct 2011 17:12:00 -0000	[thread overview]
Message-ID: <4EA82C27.3020700@oracle.com> (raw)
In-Reply-To: <4EA826EA.4040900@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

On 10/26/2011 05:27 PM, Jason Merrill wrote:
> On 10/26/2011 10:39 AM, Paolo Carlini wrote:
>> I'm trying to fix this PR, ice on valid, which Daniel kindly filed while
>> we were triaging PR50864. In short, in tsubst_copy_and_build, for
>> COMPONENT_REF, we call tsubst_baselink with an object which in this case
>> is an ARROW_EXPR, thus its TREE_TYPE is NULL_TREE.
>
> That's OK, we can pass a null type to tsubst_baselink.  Just fix 
> non_reference to pass NULL_TREE through.
Ah, very good (just read the comment preceding tsubst_baselink, should 
have done it earlier today ;) Thus I'm finishing testing the below, Ok 
if it passes?

Thanks,
Paolo.

/////////////////////////


[-- Attachment #2: CL_50870_2 --]
[-- Type: text/plain, Size: 242 bytes --]

/cp
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50870
	* typeck.c (non_reference): Pass NULL_TREE through.

/testsuite
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50870
	* g++.dg/cpp0x/decltype34.C: New.

[-- Attachment #3: patch_50870_2 --]
[-- Type: text/plain, Size: 999 bytes --]

Index: testsuite/g++.dg/cpp0x/decltype34.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype34.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/decltype34.C	(revision 0)
@@ -0,0 +1,19 @@
+// PR c++/50870
+// { dg-options "-std=gnu++0x" }
+
+struct impl
+{
+  template <class T> static T create();
+};
+
+template<class T, class U,
+	 class = decltype(impl::create<T>()->impl::create<U>())>
+struct tester{};
+
+tester<impl*, int> ti;
+
+template<class T, class U,
+	 class = decltype(impl::create<T>()->impl::create<U>())>
+int test() { return 0; }
+
+int i = test<impl*, int>();
Index: cp/typeck.c
===================================================================
--- cp/typeck.c	(revision 180528)
+++ cp/typeck.c	(working copy)
@@ -8322,7 +8322,7 @@ casts_away_constness (tree t1, tree t2)
 tree
 non_reference (tree t)
 {
-  if (TREE_CODE (t) == REFERENCE_TYPE)
+  if (t && TREE_CODE (t) == REFERENCE_TYPE)
     t = TREE_TYPE (t);
   return t;
 }

  reply	other threads:[~2011-10-26 15:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 15:28 Paolo Carlini
2011-10-26 16:25 ` Jason Merrill
2011-10-26 17:12   ` Paolo Carlini [this message]
2011-10-26 18:15     ` Jason Merrill
2011-10-26 22:54       ` Paolo Carlini
2011-10-26 23:23         ` Paolo Carlini
2011-10-27  0:00         ` Jason Merrill
2011-10-27  0:01           ` Paolo Carlini
2011-10-27  0:02             ` Paolo Carlini
2011-10-27  7:38               ` Jason Merrill
2011-10-27 12:34                 ` Paolo Carlini
2011-10-27 13:16                   ` Jason Merrill
2011-10-27 13:19                     ` Paolo Carlini
2011-10-27 13:20                       ` Jason Merrill
2011-10-27 14:56                         ` Paolo Carlini
2011-10-27 23:29                           ` Paolo Carlini
2011-10-28  1:44                             ` Paolo Carlini
2011-10-28  2:00                               ` Paolo Carlini
2011-10-28 16:59                                 ` Jason Merrill
2011-10-28 17:00                                   ` Paolo Carlini

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=4EA82C27.3020700@oracle.com \
    --to=paolo.carlini@oracle.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).