PR c++/92746 - ICE with noexcept of function concept check.
authorJason Merrill <jason@redhat.com>
Mon, 13 Jan 2020 23:13:46 +0000 (18:13 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 14 Jan 2020 01:30:18 +0000 (20:30 -0500)
Another place that needs to specially handle Concepts TS function-style
concepts.

* except.c (check_noexcept_r): Handle concept-check.

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/g++.dg/concepts/fn-concept3.C [new file with mode: 0644]

index 59646c7..4729e3d 100644 (file)
@@ -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.
index e073bd4..55b4b6a 100644 (file)
@@ -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 (file)
index 0000000..ecb7f6b
--- /dev/null
@@ -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");