Works with: 3.4.2 Fails with: 4.0.0 For some reason, the attached output warns (oddly) with the attached code:
%COMP.sh "-g -O2 -Wunused -Wextra" debug.ii /mnt/hd/src/gcc/libstdc++-v3/src/debug.cc: In instantiation of 'void __gnu_debug::_Error_formatter::_M_format_word(char*, int, const char*, _Tp) const [with _Tp = const void*]': /mnt/hd/src/gcc/libstdc++-v3/src/debug.cc:274: instantiated from here /mnt/hd/bld/gcc.disable-c99/i686-pc-linux-gnu/libstdc++-v3/include/debug/formatter.h:363: warning: unused parameter '__n' /mnt/hd/src/gcc/libstdc++-v3/src/debug.cc: In instantiation of 'void __gnu_debug::_Error_formatter::_M_format_word(char*, int, const char*, _Tp) const [with _Tp = const char*]': /mnt/hd/src/gcc/libstdc++-v3/src/debug.cc:383: instantiated from here /mnt/hd/bld/gcc.disable-c99/i686-pc-linux-gnu/libstdc++-v3/include/debug/formatter.h:363: warning: unused parameter '__n' /mnt/hd/src/gcc/libstdc++-v3/src/debug.cc: In instantiation of 'void __gnu_debug::_Error_formatter::_M_format_word(char*, int, const char*, _Tp) const [with _Tp = unsigned int]': /mnt/hd/src/gcc/libstdc++-v3/src/debug.cc:473: instantiated from here /mnt/hd/bld/gcc.disable-c99/i686-pc-linux-gnu/libstdc++-v3/include/debug/formatter.h:363: warning: unused parameter '__n' /usr/bin/ld: cannot find -lv3test collect2: ld returned 1 exit status I believe this code to be fine (indeed, with 3.4.x I have no warning.) I tried to reduce this down but didn't hit anything with the obvious reduction. So, I file this instead. -benjamin -- Summary: attribute unused vs. member function template Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bkoz at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20212