https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56100
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Paolo Carlini from comment #3) > I wonder if in such cases would it simply make sense to suppress the warning > basing on the locations I think we want to suppress the warning on instantiation even if the order is reversed: given int foo; template <typename T> struct bar { void qux () { baz (); } private: void baz () { int foo; } }; int main () { bar <int> ().qux (); } We first warn about the declaration in the template, and then again about the instantiation.