diff mbox series

PR c++/92746 - ICE with noexcept of function concept check.

Message ID 20200114012956.13186-1-jason@redhat.com
State New
Headers show
Series PR c++/92746 - ICE with noexcept of function concept check. | expand

Commit Message

Jason Merrill Jan. 14, 2020, 1:29 a.m. UTC
Another place that needs to specially handle Concepts TS function-style
concepts.

Tested x86_64-pc-linux-gnu, applying to trunk.

	* except.c (check_noexcept_r): Handle concept-check.
---
 gcc/cp/except.c                             | 2 ++
 gcc/testsuite/g++.dg/concepts/fn-concept3.C | 6 ++++++
 2 files changed, 8 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/concepts/fn-concept3.C


base-commit: 64378144aabf65bf3df2313191250accc042170e
diff mbox series

Patch

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");