]> git.ipfire.org Git - thirdparty/gcc.git/commit
Implement P1002R1, Try-catch blocks in constexpr functions
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Mar 2019 14:20:03 +0000 (14:20 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Mar 2019 14:20:03 +0000 (14:20 +0000)
commitb279a142657b2c2e94e7405e3216efe4d4a93d55
treef0b32a4e2a747b9f23167114d3bd16b4a456e95d
parent5b313df9cb738aee920eeb8b8b5cc12464e98ef1
Implement P1002R1, Try-catch blocks in constexpr functions
PR c++/89513
* parser.c (cp_parser_ctor_initializer_opt_and_function_body):
Diagnose constexpr ctor or function with function-try-block with
pedwarn for c++17 and earlier.  Formatting fix.
(cp_parser_try_block): Use pedwarn instead of error and only for
c++17 and earlier when try block appears in constexpr function.
* constexpr.c (build_constexpr_constructor_member_initializers):
Handle TRY_BLOCK here instead of erroring on it.

* g++.dg/cpp2a/constexpr-try1.C: New test.
* g++.dg/cpp2a/constexpr-try2.C: New test.
* g++.dg/cpp2a/constexpr-try3.C: New test.
* g++.dg/cpp2a/constexpr-try4.C: New test.
* g++.dg/cpp2a/constexpr-try5.C: New test.
* g++.dg/cpp0x/constexpr-ctor10.C: Don't expect error for C++2a.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269314 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor10.C
gcc/testsuite/g++.dg/cpp2a/constexpr-try1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/constexpr-try2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/constexpr-try3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/constexpr-try4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/constexpr-try5.C [new file with mode: 0644]