This ICE turned out to be a latent bug exposed by moving the member fns onto the FIELDS list.

We should be using DECL_CLONED_FUNCTION_P not DECL_CLONED_FUNCTION. Grepping showed another place (doing a similar linkage check) affected too.

nathan
--
Nathan Sidwell
2018-03-21  Nathan Sidwell  <nat...@acm.org>

	PR c++/85008
	* tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
	* decl2.c (vague_linkage_p): Likewise.

	PR c++/85008
	* g++.dg/pr85008.C: New.

Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 258722)
+++ cp/decl2.c	(working copy)
@@ -1940,7 +1940,7 @@ vague_linkage_p (tree decl)
       if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
 	   || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
 	  && DECL_CHAIN (decl)
-	  && DECL_CLONED_FUNCTION (DECL_CHAIN (decl)))
+	  && DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
 	return vague_linkage_p (DECL_CHAIN (decl));
 
       gcc_checking_assert (!DECL_COMDAT (decl));
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 258722)
+++ cp/tree.c	(working copy)
@@ -5022,7 +5022,7 @@ decl_linkage (tree decl)
   if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
        || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
       && DECL_CHAIN (decl)
-      && DECL_CLONED_FUNCTION (DECL_CHAIN (decl)))
+      && DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
     return decl_linkage (DECL_CHAIN (decl));
 
   if (TREE_CODE (decl) == NAMESPACE_DECL)
Index: testsuite/g++.dg/pr85008.C
===================================================================
--- testsuite/g++.dg/pr85008.C	(revision 0)
+++ testsuite/g++.dg/pr85008.C	(working copy)
@@ -0,0 +1,8 @@
+// PR c++/85008 ICE concerning dtor clones
+
+void a() {
+  struct b {
+    ~b();
+    int r [!!&b::~b]; // { dg-error "address of " }
+  };
+}

Reply via email to