The following code, which compiles cleanly in gcc 4.2.3, produces an error with 4.3.0:
---- template< typename T > struct X { void f(const char *fmt, ...) __attribute__((format (printf, 2, 3) )); }; template class X< void >; ---- fmt_et.cc: In instantiation of 'X<void>': fmt_et.cc:7: instantiated from here fmt_et.cc:4: error: 'printf' was not declared in this scope fmt_et.cc:4: error: unrecognized format specifier The error occurs both with explicit instantiation of the class (as above) and with implicit instantiation via an invocation of the method X<void>::f. It does not occur either for a non-template class or if the template is never instantiated. -- Summary: __attribute__((format)) fails for methods of template classes Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zak at transversal dot com GCC build triplet: x86_64_pc_linux_gnu GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: x86_64_pc_linux_gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35890