This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33911] attribute deprecated vs. templates
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Nov 2014 03:06:25 +0000
- Subject: [Bug c++/33911] attribute deprecated vs. templates
- Auto-submitted: auto-generated
- References: <bug-33911-4 at http dot gcc dot gnu dot org/bugzilla/>
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.