https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70172

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Blocks|                            |55004
      Known to fail|                            |6.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
I would normally make the Severity of a bug in the text of a diagnostic minor
but this one seems like it's more than a poorly phrased diagnostic.  The code
that triggers the error is in the potential_constant_expression_1() function in
constexp.c:

    case NOP_EXPR:
    case CONVERT_EXPR:
    case VIEW_CONVERT_EXPR:
      /* -- a reinterpret_cast.  FIXME not implemented, and this rule
         may change to something more specific to type-punning (DR 1312).  */
      {
        tree from = TREE_OPERAND (t, 0);
        if (POINTER_TYPE_P (TREE_TYPE (t))
            && TREE_CODE (from) == INTEGER_CST
            && !integer_zerop (from))
          {
            if (flags & tf_error)
              error_at (EXPR_LOC_OR_LOC (t, input_location),
                        "reinterpret_cast from integer to pointer");
            return false;
          }
        return (RECUR (from, TREE_CODE (t) != VIEW_CONVERT_EXPR));
      }


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues

Reply via email to