From edabbec31e3bfc9a9757f80c8610706ed00e5a1a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 13 Jan 2020 18:13:46 -0500 Subject: [PATCH] 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. --- gcc/cp/ChangeLog | 3 +++ gcc/cp/except.c | 2 ++ gcc/testsuite/g++.dg/concepts/fn-concept3.C | 6 ++++++ 3 files changed, 11 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/fn-concept3.C 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 + 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 concept bool C3() { return true; } +static_assert(noexcept(C3()), "function concept should be treated as if noexcept(true) specified"); -- 2.30.2