[Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error
accelerator0099 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Aug 11 15:14:49 GMT 2022
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.
More information about the Gcc-bugs
mailing list