public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105307] New: -fmax-errors truncated for concept diagnostics
@ 2022-04-19  6:58 ich.freak at gmx dot net
  2022-04-19  9:57 ` [Bug c++/105307] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ich.freak at gmx dot net @ 2022-04-19  6:58 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-20  8:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19  6:58 [Bug c++/105307] New: -fmax-errors truncated for concept diagnostics ich.freak at gmx dot net
2022-04-19  9:57 ` [Bug c++/105307] " marxin at gcc dot gnu.org
2022-04-19 14:20 ` marxin at gcc dot gnu.org
2022-04-20  8:35 ` ich.freak at gmx dot net
2022-04-20  8:42 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).