This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix ICE in C++14 with null RETURN_EXPR (PR c++/65202)


Hi Marek,

I have similiar change on the c++-delayed-fold branch.

2015-02-26 13:22 GMT+01:00 Marek Polacek <polacek@redhat.com>:
> We ICE on this invalid testcase in C++14 because in C++14 a function returning
> void is a valid constexpr function, so adl_swap is registered as one, while in
> C++11 it is not registered.  Then later on, we weren't able to properly handle
> a RETURN_EXPR with null operand when trying to evaluate the expression.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2015-02-26  Marek Polacek  <polacek@redhat.com>
>
>         PR c++/65202
>         * constexpr.c (cxx_eval_constant_expression): Handle null tree.
>
>         * g++.dg/cpp1y/pr65202.C: New test.
>
> diff --git gcc/cp/constexpr.c gcc/cp/constexpr.c
> index 32a23ff7..1d2bb2f 100644
> --- gcc/cp/constexpr.c
> +++ gcc/cp/constexpr.c
> @@ -2935,7 +2935,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
>    constexpr_ctx new_ctx;
>    tree r = t;
>
> -  if (t == error_mark_node)
> +  if (t == NULL_TREE || t == error_mark_node)
>      {
>        *non_constant_p = true;
>        return t;

Just one nit.  Shouldn't we return here always error_mark_node instead?

---
Kai


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]