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

            Bug ID: 105307
           Summary: -fmax-errors truncated for concept diagnostics
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ich.freak at gmx dot net
  Target Milestone: ---

In #92440 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92440) it was remarked
that -fmax-errors=1 truncates the first error "in the middle of the sentence"
and a patch was supplied. However, the problem still persists for concepts:


template<class T> concept HasX = requires { T::x; };
template <HasX T> struct S {};
struct NoX {};
S<NoX> s;

compiled with
> g++ -std=c++20 -fconcepts-diagnostics-depth=3 test.cpp -o test
yields:

>test.cpp:4:6: error: template constraint failure for 'template<class T>  
>>requires  HasX<T> struct S'
>    4 | S<NoX> s;
>      |      ^
>test.cpp:4:6: note: constraints not satisfied
>test.cpp: In substitution of 'template<class T>  requires  HasX<T> struct S 
>>[with T = NoX]':
>test.cpp:4:6:   required from here
>test.cpp:1:26:   required for the satisfaction of 'HasX<T>' [with T = NoX]
>test.cpp:1:33:   in requirements  [with T = NoX]
>test.cpp:1:47: note: the required expression 'T::x' is invalid, because
>    1 | template<class T>concept HasX = requires { T::x; };
>      |                                               ^
>test.cpp:1:47: error: 'x' is not a member of 'NoX'

And, if we add -fmax-errors=1, we get:

>test.cpp:4:6: error: template constraint failure for 'template<class T>  
>>requires  HasX<T> struct S'
>    4 | S<NoX> s;
>      |      ^
>test.cpp:4:6: note: constraints not satisfied
>test.cpp: In substitution of 'template<class T>  requires  HasX<T> struct S 
>>[with T = NoX]':
>test.cpp:4:6:   required from here
>test.cpp:1:26:   required for the satisfaction of 'HasX<T>' [with T = NoX]
>test.cpp:1:33:   in requirements  [with T = NoX]
>test.cpp:1:47: note: the required expression 'T::x' is invalid, because
>    1 | template<class T>concept HasX = requires { T::x; };
>      |                                               ^
>compilation terminated due to -fmax-errors=1.

However, the "explanatory errors" that are getting truncated here still
logically belong to the same error and should, therefore, not be truncated.

Reply via email to