On 2/28/19 6:03 PM, Jakub Jelinek wrote:
On Wed, Feb 27, 2019 at 06:48:13PM -0500, Jason Merrill wrote:
Or would you prefer to have P1002R1 implemented and thus make this perhaps a
pedwarn before cxx2a, similarly for the error on try block in the body and
tweak build_constexpr_constructor_member_initializers? I think constexpr
evaluation handles TRY_BLOCK already.
That sounds better, yes.
Ok, here is an updated patch that does that.
Bootstrapped/regtested on x86_64-linux and i686-linux (98,11,14,17,2a in
both cases), ok for trunk?
2019-02-28 Jakub Jelinek <ja...@redhat.com>
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.
OK.
Jason