public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112293] New: Enhance error reporting with fix-it for missing <algorithm> in gcc 14
@ 2023-10-30 13:51 arkamar at atlas dot cz
  2023-10-30 14:09 ` [Bug c++/112293] " redi at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: arkamar at atlas dot cz @ 2023-10-30 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112293
           Summary: Enhance error reporting with fix-it for missing
                    <algorithm> in gcc 14
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arkamar at atlas dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
             Build: x86_64-pc-linux-gnu

We encountered an issue while attempting to build the rspamd package using
gcc-14 on Gentoo Linux. The build process fails with a somewhat ambiguous error
message [1]. However, the same package compiles successfully with gcc-13.

The issue appears to arise from internal changes in libstdc++ that now require
the explicit inclusion of the <algorithm> header (this part is likely a bug
within rspamd). Is it possible to enhance the error messaging, perhaps with a
fix-it hint, to suggest that <algorithm> needs to be explicitly included for
clarity?

Here is the minimized snippet to reproduce the issue:

#include <functional>
#include <stdexcept>
struct test;
std::vector<test *> v;
auto f(test *t) {
  auto it = std::remove(begin(v), end(v), t);
}

which currently fails with the following error message:

test.cxx: In function _auto f(test*)_:
test.cxx:6:30: error: cannot convert _std::vector<test*>::iterator_ to _const
char*_
    6 |   auto it = std::remove(begin(v), end(v), t);
      |                         ~~~~~^~~
      |                              |
      |                              std::vector<test*>::iterator
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/cstdio:42,
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/ext/string_conversions.h:45,
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/basic_string.h:4158,
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/string:54,
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/stdexcept:39,
                 from test.cxx:2:
/usr/include/stdio.h:157:32: note:   initializing argument 1 of _int
remove(const char*)_
  157 | extern int remove (const char *__filename) __THROW;
      |

I tested this with: gcc version 14.0.0 20231022 (experimental) (Gentoo
14.0.0_pre20231022-r1 p7)

[1] https://bugs.gentoo.org/916438

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

end of thread, other threads:[~2024-01-21 21:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 13:51 [Bug c++/112293] New: Enhance error reporting with fix-it for missing <algorithm> in gcc 14 arkamar at atlas dot cz
2023-10-30 14:09 ` [Bug c++/112293] " redi at gcc dot gnu.org
2023-10-30 14:11 ` redi at gcc dot gnu.org
2023-10-30 14:26 ` redi at gcc dot gnu.org
2023-10-30 14:30 ` redi at gcc dot gnu.org
2023-10-30 14:33 ` arkamar at atlas dot cz
2023-10-30 14:42 ` redi at gcc dot gnu.org
2023-10-30 23:55 ` sjames at gcc dot gnu.org
2024-01-21 20:50 ` redi at gcc dot gnu.org
2024-01-21 21:33 ` fw 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).