public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 44625
@ 2011-06-23 11:56 Paolo Carlini
  2011-06-23 15:17 ` Jason Merrill
  0 siblings, 1 reply; 15+ messages in thread
From: Paolo Carlini @ 2011-06-23 11:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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

Hi,

a patchlet for a pretty old ice-on-invalid regression. Tested x86_64-linux.

Ok for mainline?

Thanks,
Paolo.

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

[-- Attachment #2: CL_44625 --]
[-- Type: text/plain, Size: 261 bytes --]

/cp
2011-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44625
	* pt.c (tsubst_copy_and_build): Do not use BASELINK_P on a NULL_TREE.

/testsuite
2011-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44625
	* g++.dg/template/crash107.C: New.

[-- Attachment #3: patch_44625 --]
[-- Type: text/plain, Size: 1360 bytes --]

Index: testsuite/g++.dg/template/crash107.C
===================================================================
--- testsuite/g++.dg/template/crash107.C	(revision 0)
+++ testsuite/g++.dg/template/crash107.C	(revision 0)
@@ -0,0 +1,20 @@
+// PR c++/44625
+// { dg-do compile }
+// { dg-options "" }
+
+template<typename FP_> struct Vec { // { dg-message "note" }
+    Vec& operator^=(Vec& rhs)     {
+        union {
+            struct {FP_ x,y,z;};
+        }; // { dg-error "anonymous struct" }
+        X = y*rhs.z() - z*rhs.y(); // { dg-error "not declared|no member" }
+    }
+    Vec& operator^(Vec& rhs) {
+        return Vec(*this)^=rhs; // { dg-message "required" }
+    }
+};
+Vec<double> v(3,4,12); // { dg-error "no matching" }
+// { dg-message "note" { target *-*-* } 16 }
+Vec<double> V(12,4,3);  // { dg-error "no matching" }
+// { dg-message "note" { target *-*-* } 18 }
+Vec<double> c = v^V;   // { dg-message "required" }
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 175328)
+++ cp/pt.c	(working copy)
@@ -13252,6 +13252,9 @@ tsubst_copy_and_build (tree t,
 	object_type = TREE_TYPE (object);
 
 	member = TREE_OPERAND (t, 1);
+	if (!member)
+	  return error_mark_node;
+
 	if (BASELINK_P (member))
 	  member = tsubst_baselink (member,
 				    non_reference (TREE_TYPE (object)),

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [C++ Patch] PR 44625
@ 2010-07-05 11:52 Paolo Carlini
  2010-07-05 13:10 ` Jason Merrill
  0 siblings, 1 reply; 15+ messages in thread
From: Paolo Carlini @ 2010-07-05 11:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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

Hi,

I have this patchlet for another case where we use BASELINK_P on
NULL_TREE. Tested x86_64-linux. I propose to apply it to mainline and
4_5-branch only and then close the PR: it's a regression, but just a P5
ice-on-invalid.

Thanks,
Paolo.

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

[-- Attachment #2: CL_44625 --]
[-- Type: text/plain, Size: 262 bytes --]

/cp
2010-07-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44625
	* pt.c (tsubst_copy_and_build): Do not apply BASELINK_P on
	NULL_TREE.

/testsuite
2010-07-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44625
	* g++.dg/template/crash102.C: New.

[-- Attachment #3: patch_44625 --]
[-- Type: text/plain, Size: 1558 bytes --]

Index: testsuite/g++.dg/template/crash102.C
===================================================================
--- testsuite/g++.dg/template/crash102.C	(revision 0)
+++ testsuite/g++.dg/template/crash102.C	(revision 0)
@@ -0,0 +1,19 @@
+// PR c++/44625
+// { dg-do compile }
+// { dg-options "" }
+
+template<typename FP_> struct Vec { // { dg-message "note" }
+    Vec& operator^=(Vec& rhs)     {
+        union {
+            struct {FP_ x,y,z;};
+        }; // { dg-error "anonymous struct" }
+        y*rhs.z() - z*rhs.y(); // { dg-error "no member" }
+	return *this;
+    }
+    Vec& operator^(Vec& rhs) {
+        return Vec(*this)^=rhs; // { dg-message "instantiated" }
+    }
+};
+Vec<double> v(3,4,12);  // { dg-error "no matching" }
+Vec<double> V(12,4,3);  // { dg-error "no matching" }
+Vec<double> c = v^V;    // { dg-message "instantiated" }
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 161825)
+++ cp/pt.c	(working copy)
@@ -12625,7 +12625,9 @@ tsubst_copy_and_build (tree t,
       {
 	tree object;
 	tree object_type;
-	tree member;
+	tree member = TREE_OPERAND (t, 1);
+	if (!member)
+	  return error_mark_node;
 
 	object = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
 						     args, complain, in_decl);
@@ -12634,7 +12636,6 @@ tsubst_copy_and_build (tree t,
 	  mark_used (object);
 	object_type = TREE_TYPE (object);
 
-	member = TREE_OPERAND (t, 1);
 	if (BASELINK_P (member))
 	  member = tsubst_baselink (member,
 				    non_reference (TREE_TYPE (object)),

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

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

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23 11:56 [C++ Patch] PR 44625 Paolo Carlini
2011-06-23 15:17 ` Jason Merrill
2011-06-23 15:47   ` Paolo Carlini
2011-06-23 16:01     ` Jason Merrill
2011-06-23 16:06       ` Paolo Carlini
2011-06-23 16:06         ` Jason Merrill
2011-06-23 16:06           ` Jason Merrill
2011-06-23 16:13             ` Paolo Carlini
2011-06-23 16:19               ` Paolo Carlini
2011-06-23 16:53             ` Paolo Carlini
2011-06-23 16:54               ` Jason Merrill
2011-06-23 16:11           ` Paolo Carlini
  -- strict thread matches above, loose matches on Subject: below --
2010-07-05 11:52 Paolo Carlini
2010-07-05 13:10 ` Jason Merrill
2010-07-05 13:13   ` 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).