public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch / RFC] PR 50870
@ 2011-10-26 15:28 Paolo Carlini
  2011-10-26 16:25 ` Jason Merrill
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Carlini @ 2011-10-26 15:28 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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

Hi,

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. I'm trying to fix 
this be using the first operand instead, as we normally do for 
ARROW_EXPRs elsewhere. Note that, assuming this makes sense, we probably 
want to audit also case COMPONENT_REF in tsubst_copy...

What do you think?

(Tested already x86_64-linux)

Thanks,
Paolo.

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

[-- Attachment #2: CL_50870 --]
[-- Type: text/plain, Size: 295 bytes --]

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

	PR c++/50870
	* pt.c (tsubst_copy_and_build): When object is an ARROW_EXPR
	pass to tsubst_baselink its first operand.

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

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

[-- Attachment #3: patch_50870 --]
[-- Type: text/plain, Size: 1191 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/pt.c
===================================================================
--- cp/pt.c	(revision 180520)
+++ cp/pt.c	(working copy)
@@ -13711,7 +13711,9 @@ tsubst_copy_and_build (tree t,
 	member = TREE_OPERAND (t, 1);
 	if (BASELINK_P (member))
 	  member = tsubst_baselink (member,
-				    non_reference (TREE_TYPE (object)),
+				    TREE_CODE (object) == ARROW_EXPR
+				    ? TREE_OPERAND (object, 0)
+				    : non_reference (TREE_TYPE (object)),
 				    args, complain, in_decl);
 	else
 	  member = tsubst_copy (member, args, complain, in_decl);

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-10-28 16:23 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-26 15:28 [C++ Patch / RFC] PR 50870 Paolo Carlini
2011-10-26 16:25 ` Jason Merrill
2011-10-26 17:12   ` Paolo Carlini
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

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).