[gcc/devel/ranger] PR c++/92746 - ICE with noexcept of function concept check.

Aldy Hernandez aldyh@gcc.gnu.org
Wed Jun 17 17:53:53 GMT 2020


https://gcc.gnu.org/g:edabbec31e3bfc9a9757f80c8610706ed00e5a1a

commit edabbec31e3bfc9a9757f80c8610706ed00e5a1a
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jan 13 18:13:46 2020 -0500

            PR c++/92746 - ICE with noexcept of function concept check.
    
    Another place that needs to specially handle Concepts TS function-style
    concepts.
    
            * except.c (check_noexcept_r): Handle concept-check.

Diff:
---
 gcc/cp/ChangeLog                            | 3 +++
 gcc/cp/except.c                             | 2 ++
 gcc/testsuite/g++.dg/concepts/fn-concept3.C | 6 ++++++
 3 files changed, 11 insertions(+)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 59646c70fa4..4729e3d331d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
 2020-01-13  Jason Merrill  <jason@redhat.com>
 
+	PR c++/92746 - ICE with noexcept of function concept check.
+	* except.c (check_noexcept_r): Handle concept-check.
+
 	PR c++/92582 - ICE with member template as requirement.
 	* pt.c (struct find_template_parameter_info): Add ctx_parms.
 	(any_template_parm_r): Handle TEMPLATE_DECL.
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index e073bd4d2bc..55b4b6af442 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1117,6 +1117,8 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees*/, void * /*data*/)
 
          We could use TREE_NOTHROW (t) for !TREE_PUBLIC fns, though... */
       tree fn = cp_get_callee (t);
+      if (concept_check_p (fn))
+	return NULL_TREE;
       tree type = TREE_TYPE (fn);
       gcc_assert (INDIRECT_TYPE_P (type));
       type = TREE_TYPE (type);
diff --git a/gcc/testsuite/g++.dg/concepts/fn-concept3.C b/gcc/testsuite/g++.dg/concepts/fn-concept3.C
new file mode 100644
index 00000000000..ecb7f6b12f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/fn-concept3.C
@@ -0,0 +1,6 @@
+// PR c++/92746
+// { dg-do compile { target c++17_only } }
+// { dg-options "-fconcepts" }
+
+template<typename T> concept bool C3() { return true; }
+static_assert(noexcept(C3<int>()), "function concept should be treated as if noexcept(true) specified");


More information about the Gcc-cvs mailing list