https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78770
Bug ID: 78770 Summary: error: 'bar' was not declared in this scope. note: suggested alternative: 'bar' Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: safinaskar at mail dot ru Target Milestone: --- Consider this code: struct foo { friend void bar (void); void baz (void) { bar (); } }; void bar (void) { } g++ gives very strange "suggestion": gcrash.cpp: In member function 'void foo::baz()': gcrash.cpp:8:5: error: 'bar' was not declared in this scope bar (); ^~~ gcrash.cpp:8:5: note: suggested alternative: 'bar' bar (); ^~~ bar Error seems to be legit. Problem is in suggestion. g++ suggests to replace "bar" with "bar". (???) Command line: /usr/lib/gcc-snapshot/bin/g++ -std=c++1z -fdiagnostics-color=always -c -o /dev/null gcrash.cpp debian gnu/linux stretch amd64 (x86_64). debian package gcc-snapshot 20161124-2. gcc -v: Using built-in specs. COLLECT_GCC=/usr/lib/gcc-snapshot/bin/gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/7.0.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 20161124-2' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,go,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --program-prefix= --enable-shared --enable-linker-build-id --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.0.0 20161124 (experimental) [trunk revision 242836] (Debian 20161124-2)