This fixes half of PR51712. The other half is added as XFAIL.
Bootstrapped and regression tested.

OK?

Fixing the other half requires either

* Make build_binary_op take c_expr instead of trees. This will require adding
c_expr to the C++ FE. For now, the C++ FE will just encapsulate the trees into
c_expr before calling  build_binary_op and nothing else. If the long-term goal
is that C/C++ FEs track the original source code more faithfully, I think this
is the right step. The use of c_expr should help to achieve this.

* Pass 4 more arguments to build_binary_op, and add a
wrapper to avoid changing the interface for C++ FE. This restricts the changes
to the C FE (and c-common.c) but it is really ugly.

Jason, what is your opinion about adding c_expr to the C++ FE?

2012-05-01  Manuel López-Ibáñez  <m...@gcc.gnu.org>

        PR c/51712
c-family/
        * c-common.c (expr_original_type): New.
        (shorten_compare): Do not warn for enumeration types.
testsuite/
        * c-c++-common/pr51712.c: New.

Attachment: fix-pr51712.diff
Description: Binary data

Reply via email to