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

            Bug ID: 85312
           Summary: trunk/gcc/cp/parser.c:12041: poor error checking ?
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

trunk/gcc/cp/parser.c:12041] -> [trunk/gcc/cp/parser.c:12044]: (warning)
Identical inner 'if' condition is always true.

Source code is

      if (member_begin != NULL_TREE && member_end != NULL_TREE)
        {
          /* Use the member functions.  */
          if (member_begin != NULL_TREE)
            *begin = cp_parser_range_for_member_function (range, id_begin);
          else
            error ("range-based %<for%> expression of type %qT has an "
                   "%<end%> member but not a %<begin%>", TREE_TYPE (range));

          if (member_end != NULL_TREE)
            *end = cp_parser_range_for_member_function (range, id_end);
          else
            error ("range-based %<for%> expression of type %qT has a "
                   "%<begin%> member but not an %<end%>", TREE_TYPE (range));
        }

I think the error messages can never be reached. This looks wrong to me.

Reply via email to