// gcc-bug: attribute((sentinel)) warning does not trigger for member function template // // how to reproduce: g++-4.1.1 -Wall -c test.cpp // Markus F.X.J. Oberhumer <markus@oberhumer.com> #define SENTINEL __attribute__((__sentinel__)) void func1(const char *, ...) SENTINEL; template <class T> void func2(const T *, ...) SENTINEL; static void func3(const char *, ...) SENTINEL; template <class T> static void func4(const T *, ...) SENTINEL; struct C { void func1(const char *, ...) SENTINEL; template <class T> void func2(const T *, ...) SENTINEL; static void func3(const char *, ...) SENTINEL; template <class T> static void func4(const T *, ...) SENTINEL; }; static void func3(const char *, ...) { } // definition void foo(C &c) { func1("a", "b"); // warning here func2("a", "b"); // warning here func3("a", "b"); // warning here func4("a", "b"); // warning here c.func1("a", "b"); // warning here c.func2("a", "b"); // NO warning here ! c.func3("a", "b"); // warning here c.func4("a", "b"); // NO warning here ! }
Confirmed.
This seems to have been fixed in gcc-4.9.
It was fixed in r203174 committed to fix PR c++/33911 (attribute deprecated vs. templates).