This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I've fixed most of the tests but I think the remaining ones reveal that the
warning is a bit too eager:

template<typename T>
struct B
{
  B(T t) { }

} __attribute__ ((__deprecated__));

template<typename T>
B<T> b(T t)
{
  return B<T>(t);
}

int main()
{
}

dep.cc:9:11: warning: âBâ is deprecated (declared at dep.cc:2)
[-Wdeprecated-declarations]
 B<T> b(T t)
           ^
dep.cc: In function âB<T> b(T)â:
dep.cc:11:16: warning: âBâ is deprecated (declared at dep.cc:2)
[-Wdeprecated-declarations]
   return B<T>(t);
                ^

The warning comes even when b() isn't instantiated and can't be disabled with a
#pragma.

I have no idea why this only affects 3 tests, not all the -std=gnu++11 tests,
so maybe I should just add -D_GLIBCXX_USE_DEPRECATED=0 to the dg-options for
those three tests to prevent the deprecated components being included.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]