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

            Bug ID: 104810
           Summary: Wrong order of "note: ... this enumerator %qD"
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic, testsuite-fail
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland.illig at gmx dot de
  Target Milestone: ---

>From cp/module.cc:
> inform (DECL_SOURCE_LOCATION (new_decl),
>         "... this enumerator %qD", new_decl);
> inform (DECL_SOURCE_LOCATION (known_decl),
>         "enumerator %qD does not match ...", known_decl);

In the source code, these two calls should be swapped, to allow reading the
source code from top to bottom.

The diagnostics in enum-bad-1_b.C are extremely hard to read in their current
form, I had to manually wrap the lines in order to see the order of the
messages.  No wonder nobody noticed that the grammar of the diagnostics didn't
make sense.

There must be a way for large dg-regexp annotations to be split into multiple
lines.  To understand the diagnostics, I reformatted it to:
> // { dg-regexp {
> // In module [^\n]*enum-bad-1_a.H, imported at [^\n]*enum-bad-1_b.C:8:\n
> // [^\n]*enum-bad-1_a.H:5:6: error: definition of 'enum ONE' does not match\n
> // [^\n]*enum-bad-1_b.C:3:6: note: existing definition 'enum ONE'\n
> // In module [^\n]*enum-bad-1_a.H, imported at [^\n]*enum-bad-1_b.C:8:\n
> // [^\n]*enum-bad-1_a.H:5:11: note: ... this enumerator 'A'\n
> // [^\n]*enum-bad-1_b.C:3:11: note: enumerator 'Q' does not match ...\n
> // [^\n]*enum-bad-1_b.C:15:1: note: during load of binding '::ONE'\n
> // }
> // }

This clearly shows that the two "..." do not match.

Marked as "testsuite-fail" since it is a classical fail of the testsuite to not
provide enough stylistic freedom to make the source code of the tests readable
without manual editing.

Reply via email to