Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
10/1/26 [GH #197]
Deducing noexcept-specifiers

Previously, the front end emulated Clang and GCC's ability to deduce simple
dependent noexcept-specifiers (see the entry for EDGcpfe/18317 of 9/6/17).
Meanwhile, the standard has been changed through Core issue 2355 to make that
behavior standard-mandated. It is now the default behavior, except in
Microsoft mode with microsoft_version < 1951.


Version 7.0, September 28, 2026

9/15/26 [EDGcpfe/28958]
Expand Down
12 changes: 3 additions & 9 deletions src/cmd_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -3237,7 +3237,7 @@ option values if they were not already set by a command line option.
exc_spec_in_func_type = TRUE;
} /* if */
#endif /* EXC_SPEC_IN_FUNC_TYPE_ENABLING_POSSIBLE */
deduction_from_exc_spec_allowed = FALSE;
deduction_from_exc_spec_allowed = microsoft_version >= 1951;
if (!option_kind_used[(int)optk_aligned_new]) {
overaligned_allocation_enabled = TRUE;
} /* if */
Expand Down Expand Up @@ -5928,13 +5928,7 @@ before this routine is called.
warn_on_deduced_return_types = TRUE;
} /* if */
} /* if */
if (cpp17_mode) {
/* g++ and clang allow deduction from the noexcept flag of a function
parameter. */
if (exc_spec_in_func_type) {
deduction_from_exc_spec_allowed = TRUE;
} /* if */
} else {
if (!cpp17_mode) {
/* g++ and clang do not implement this as a DR in C++14 mode. Note that
clang has this disabled by default even in C++17 mode (as of 6.0.1).
But we don't have a separate option to enable this, so we still
Expand Down Expand Up @@ -13281,7 +13275,7 @@ variables declared in cmd_line.h.
implicit_noexcept_enabled = FALSE;
core_constant_expr_is_noexcept = FALSE;
exc_spec_in_func_type = FALSE;
deduction_from_exc_spec_allowed = FALSE;
deduction_from_exc_spec_allowed = TRUE;
delegating_constructors_enabled = FALSE;
inheriting_constructors_enabled = FALSE;
constexpr_enabled = FALSE;
Expand Down
6 changes: 1 addition & 5 deletions src/templates.c
Original file line number Diff line number Diff line change
Expand Up @@ -13889,9 +13889,6 @@ A nontype template parameter is potentially being deduced from a noexcept
specifier. For example:

template<bool B> void f(int (*)() noexcept(B));

This is currently nonstandard, but accepted by GCC and Clang, and the omission
in the standard is perhaps accidental.
*/
{
a_boolean match = FALSE;
Expand All @@ -13910,8 +13907,7 @@ in the standard is perhaps accidental.
if (deduction_from_exc_spec_allowed &&
(flags & MTT_ALLOW_STRICTER_NOEXCEPT) == 0 &&
!constant_bool_value_known_at_compile_time(t_cp)) {
/* Some compilers allow deduction from the noexcept flag of a function
type. Do this deduction, if needed. */
/* Perform deduction from the noexcept flag of a function type. */
a_constant_ptr cp;
a_boolean cp_is_local = FALSE;
if (esp != NULL && esp->variant.noexcept_arg != NULL) {
Expand Down
3 changes: 0 additions & 3 deletions tests/expectations/edg_x86_32/cwg.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
2355a.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355c.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355d.sft.cpp:fn:-DTEST_NUMBER=1:FAIL:
P2615R1a.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
P2647R1b.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
cwg1028c.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
Expand Down
3 changes: 0 additions & 3 deletions tests/expectations/edg_x86_32_cp/cwg.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
2355a.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355c.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355d.sft.cpp:fn:-DTEST_NUMBER=1:FAIL:
P2615R1a.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
P2647R1b.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
cwg1028c.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
Expand Down
3 changes: 0 additions & 3 deletions tests/expectations/edg_x86_64/cwg.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
2355a.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355c.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355d.sft.cpp:fn:-DTEST_NUMBER=1:FAIL:
P2615R1a.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
P2647R1b.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
cwg1028c.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
Expand Down
3 changes: 0 additions & 3 deletions tests/expectations/edg_x86_64_cp/cwg.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
2355a.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355c.sft.cpp:cp:-DTEST_NUMBER=1:FAIL:
2355d.sft.cpp:fn:-DTEST_NUMBER=1:FAIL:
P2615R1a.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
P2647R1b.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
cwg1028c.sft.cpp:fp:-DTEST_NUMBER=1:FAIL:
Expand Down
3 changes: 2 additions & 1 deletion tests/tests/cwg/2355a.sft.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//options_all:--c++20 -tused -A
//options:--c++17 -A:--c++17 --gn 160200:--c++17 --clang_version 230100:--ms_c++17 --microsoft_version 1950;fn:--ms_c++17 --microsoft_version 1951:--c++14 -A;fn:--c++14 --gn 160200;fn:--c++14 --clang_version 230100;fn:--ms_c++14 --microsoft_version 1950;fn:--ms_c++14 --microsoft_version 1951;fn
//options_all:-tused
template <bool E> void f1(void (*)() noexcept(E));

void g1();
Expand Down
Loading