[gcc/devel/c++-modules] c++: Fix deferred noexcept on constructor [PR93901].

Nathan Sidwell nathan@gcc.gnu.org
Thu Mar 19 12:38:34 GMT 2020


https://gcc.gnu.org/g:481fcfe6fec156ca2a6baea4b623076e2eefa6a6

commit 481fcfe6fec156ca2a6baea4b623076e2eefa6a6
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Mar 10 17:31:33 2020 -0400

    c++: Fix deferred noexcept on constructor [PR93901].
    
    My change in r10-4394 to only update clones when we actually instantiate a
    deferred noexcept-spec broke this because deferred parsing updates the
    primary function but not the clones.  For GCC 10, let's just revert it.
    
    gcc/cp/ChangeLog
    2020-03-10  Jason Merrill  <jason@redhat.com>
    
            PR c++/93901
            * pt.c (maybe_instantiate_noexcept): Always update clones.

Diff:
---
 gcc/cp/ChangeLog |  5 +++++
 gcc/cp/pt.c      | 14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b60b1ecc604..9e0b48886ad 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-10  Jason Merrill  <jason@redhat.com>
+
+	PR c++/93901
+	* pt.c (maybe_instantiate_noexcept): Always update clones.
+
 2020-03-10  Jason Merrill  <jason@redhat.com>
 
 	PR c++/93956
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 179716b5680..cb237ba0d9d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25097,14 +25097,14 @@ maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain)
       TREE_TYPE (fn) = build_exception_variant (fntype, spec);
       if (orig_fn)
 	TREE_TYPE (orig_fn) = TREE_TYPE (fn);
+    }
 
-      FOR_EACH_CLONE (clone, fn)
-	{
-	  if (TREE_TYPE (clone) == fntype)
-	    TREE_TYPE (clone) = TREE_TYPE (fn);
-	  else
-	    TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec);
-	}
+  FOR_EACH_CLONE (clone, fn)
+    {
+      if (TREE_TYPE (clone) == fntype)
+	TREE_TYPE (clone) = TREE_TYPE (fn);
+      else
+	TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec);
     }
 
   return true;


More information about the Gcc-cvs mailing list