public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error
@ 2022-08-11 15:14 accelerator0099 at gmail dot com
  2022-08-11 15:15 ` [Bug c++/106584] " accelerator0099 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: accelerator0099 at gmail dot com @ 2022-08-11 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106584
           Summary: g++ not showing correct line number in "use of deleted
                    function" error
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: accelerator0099 at gmail dot com
  Target Milestone: ---

Example code:
----------------------------------------------------
#include <map>
#include <memory>

using int_map = std::map<int, std::unique_ptr<int>>;

void f(int_map cl);

void f2() {
    int_map cl;
    f(cl);
}
----------------------------------------------------

The actual error is that int_map is not copiable, so line 10 is ill-formed
But the compiler doesn't tell you anything about line 10, it just prints tons
of waste

This is unreasonable. You may make such a careless mistake (missing a '&') in
thousands of lines, the compiler should locate where the error is for you.

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

* [Bug c++/106584] g++ not showing correct line number in "use of deleted function" error
  2022-08-11 15:14 [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error accelerator0099 at gmail dot com
@ 2022-08-11 15:15 ` accelerator0099 at gmail dot com
  2022-08-11 15:16 ` accelerator0099 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: accelerator0099 at gmail dot com @ 2022-08-11 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Devourer Station <accelerator0099 at gmail dot com> ---
Created attachment 53436
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53436&action=edit
Preprocessed source file

compile with g++ example.cpp -c

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

* [Bug c++/106584] g++ not showing correct line number in "use of deleted function" error
  2022-08-11 15:14 [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error accelerator0099 at gmail dot com
  2022-08-11 15:15 ` [Bug c++/106584] " accelerator0099 at gmail dot com
@ 2022-08-11 15:16 ` accelerator0099 at gmail dot com
  2022-08-11 15:42 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: accelerator0099 at gmail dot com @ 2022-08-11 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Devourer Station <accelerator0099 at gmail dot com> ---
Created attachment 53437
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53437&action=edit
compiler's output

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

* [Bug c++/106584] g++ not showing correct line number in "use of deleted function" error
  2022-08-11 15:14 [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error accelerator0099 at gmail dot com
  2022-08-11 15:15 ` [Bug c++/106584] " accelerator0099 at gmail dot com
  2022-08-11 15:16 ` accelerator0099 at gmail dot com
@ 2022-08-11 15:42 ` pinskia at gcc dot gnu.org
  2022-08-11 15:43 ` pinskia at gcc dot gnu.org
  2022-08-12  6:52 ` accelerator0099 at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-11 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang prints out the similar message (even with libc++).

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

* [Bug c++/106584] g++ not showing correct line number in "use of deleted function" error
  2022-08-11 15:14 [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error accelerator0099 at gmail dot com
                   ` (2 preceding siblings ...)
  2022-08-11 15:42 ` pinskia at gcc dot gnu.org
@ 2022-08-11 15:43 ` pinskia at gcc dot gnu.org
  2022-08-12  6:52 ` accelerator0099 at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-11 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually clang references the call:
f(cl);

When it comes to the copy constructor.

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

* [Bug c++/106584] g++ not showing correct line number in "use of deleted function" error
  2022-08-11 15:14 [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error accelerator0099 at gmail dot com
                   ` (3 preceding siblings ...)
  2022-08-11 15:43 ` pinskia at gcc dot gnu.org
@ 2022-08-12  6:52 ` accelerator0099 at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: accelerator0099 at gmail dot com @ 2022-08-12  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Devourer Station <accelerator0099 at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> Actually clang references the call:
> f(cl);
> 
> When it comes to the copy constructor.

At least it tells you about where the error is, otherwise you may fall into
thousands of lines of source code without knowing where to edit

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

end of thread, other threads:[~2022-08-12  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 15:14 [Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error accelerator0099 at gmail dot com
2022-08-11 15:15 ` [Bug c++/106584] " accelerator0099 at gmail dot com
2022-08-11 15:16 ` accelerator0099 at gmail dot com
2022-08-11 15:42 ` pinskia at gcc dot gnu.org
2022-08-11 15:43 ` pinskia at gcc dot gnu.org
2022-08-12  6:52 ` accelerator0099 at gmail dot com

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).