https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125822
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:afc3eefb99d9a25909539bf6dd3c4ca403f23948 commit r17-3613-gafc3eefb99d9a25909539bf6dd3c4ca403f23948 Author: Jakub Jelinek <[email protected]> Date: Mon Aug 24 23:45:42 2026 +0200 c++: Implement C++29 P3822R2 - Conditional noexcept specifiers in compound requirements [PR125822] The following patch implements the C++29 P3822R2 - Conditional noexcept specifiers in compound requirements paper. For mangling I've used what the clang++ fork mentioned in the paper uses, so no N for no noexcept (as before) or noexcept (false), N for noexcept (as before) or noexcept (true) and C <expression> for noexcept (<expression>). I've also checked all these new testcases against that clang++ fork on godbolt (again, link in the paper), everything is accepted or rejected the same in both compilers, just there is apparently a difference in the mangling but preexisting and unrelated to this exact patch (the no N vs. N vs. C <expression> is actually the same). 2026-08-24 Jakub Jelinek <[email protected]> PR c++/125822 gcc/c-family/ * c-cppbuiltin.cc (c_cpp_builtins): Define __cpp_concepts to 202606L rather than 202002L for C++29. gcc/cp/ * cp-tree.def: Implement C++29 P3822R2 - Conditional noexcept specifiers in compound requirements. (COMPOUND_REQ): Use 3 operands rather than 2, adjust comment. * cp-tree.h (COMPOUND_REQ_NOEXCEPT_P): Remove. (finish_compound_requirement): Change last argument from bool to tree. * parser.cc (cp_parser_compound_requirement): Parse C++29 conditional noexcept in compound requirement. Pass a tree to finish_compound_requirement rather than bool. * constraint.cc (tsubst_compound_requirement): Read noexcept from TREE_OPERAND (req, 2) rather than COMPOUND_REQ_NOEXCEPT_P (req), instantiate, convert, evaluate and pass to finish_compound_requirement. (finish_compound_requirement): Change last argument from bool to tree, store it as third operand of COMPOUND_REQ rather than in COMPOUND_REQ_NOEXCEPT_P flag and call check_for_bare_parameter_packs on it. * cxx-pretty-print.cc (pp_cxx_compound_requirement): Print noexcept with argument if TREE_OPERAND (t, 2) is neither true nor false constant and check it for printing "noexcept" instead oof COMPOUND_REQ_NOEXCEPT_P flag. * mangle.cc (write_requirement): Don't use COMPOUND_REQ_NOEXCEPT_P flag, instead mangle without N or with N if third operand is false or true constant and as C <expression> otherwise. gcc/testsuite/ * g++.dg/cpp29/complex-req-noexcept1.C: New test. * g++.dg/cpp29/complex-req-noexcept2.C: New test. * g++.dg/cpp29/complex-req-noexcept3.C: New test. * g++.dg/cpp29/complex-req-noexcept4.C: New test. * g++.dg/cpp29/complex-req-noexcept5.C: New test. * g++.dg/cpp29/feat-cxx29.C: Expect __cpp_concepts 202606L rather than 202002L for C++29. Reviewed-by: Jason Merrill <[email protected]>
