https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109755
Bug ID: 109755
Summary: -Wunused-function underline points at a class, not the
unused method itself
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Noticed when reduced example manually. Was a bit confused by an underline under
the class and not the method:
// $ cat a.cc
namespace {
struct Foo {
void m1();
void m2();
};
void Foo::m1() {}
void Foo::m2() {}
}
int main() {
Foo o;
o.m1();
}
$ gcc -c a.cc -Wall
a.cc:7:10: warning: 'void {anonymous}::Foo::m2()' defined but not used
[-Wunused-function]
7 | void Foo::m2() {}
| ^~~
Here it's not visible, but m2 is correctly highlighted in 'void
{anonymous}::Foo::m2()' string (good). But the underlying cursor points at the
'Foo' only. I think it should point at the whole 'Foo::m2' instead.
For example:
7 | void Foo::m2() {}
| ^~~~~~~
WDYT?
GCC is built from r14-539-g143e6695b20d35.
$ gcc -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-14.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-14.0.0/libexec/gcc/x86_64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 99999999 (experimental) (GCC)