[Bug c++/33911] attribute deprecated vs. templates

niemayer at isg dot de gcc-bugzilla@gcc.gnu.org
Thu Dec 20 14:33:00 GMT 2007



------- Comment #2 from niemayer at isg dot de  2007-12-20 14:32 -------
I can second that problem for template member functions - in contrast to
non-template member functions, where the attribute works.

This gives a warning about deprecation as expected:
-----------------------------------------------------------------
struct T { } ;

struct A {
        inline void foo(T & ) __attribute__((deprecated));
};

inline void A::foo(T & ) { }

void test(T & t) {
        A a;
        a.foo(t);
}
-------------------------------------------------------------

... while this is not causing a warning as it should:
-------------------------------------------------------------
struct A {
        template <class T> inline void foo(T & ) __attribute__((deprecated));
};

template <class T> inline void A::foo(T & ) { }

void test(A & t) {
        A a;
        a.foo(t);
}
-------------------------------------------------------------


-- 

niemayer at isg dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |niemayer at isg dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33911



More information about the Gcc-bugs mailing list