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

            Bug ID: 92440
           Summary: Error output for first error truncated with
                    -fmax-errors=1
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: travis.downs at gmail dot com
  Target Milestone: ---

Consider the following code snippet:

template <int T>
struct S {
    template <class U>
    friend struct S; 
};

S<0> s;

Compiled with gcc trunk 10.0.0 and any earlier version I tried, it produces
with following error without any explicit command line flags:

1
x86-64 gcc (trunk)
- cached

    #2 with x86-64 gcc (trunk)

<source>: In instantiation of 'struct S<0>':

<source>:7:6:   required from here

<source>:1:15: error: template parameter 'int T'

    1 | template <int T>

      |               ^

<source>:4:19: error: redeclared here as 'class U'

    4 |     friend struct S;

      |                   ^

Compiler returned: 1

That's logically a single error.

With -fmax-errors=1 the error is truncated in the middle of a "sentence" with
only the first part visible, which prevents understanding the error:

<source>: In instantiation of 'struct S<0>':

<source>:7:6:   required from here

<source>:1:15: error: template parameter 'int T'

    1 | template <int T>

      |               ^

compilation terminated due to -fmax-errors=1.

Compiler returned: 1


Godbolt link:

https://godbolt.org/z/bX2z4f

Reply via email to