https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123996
Bug ID: 123996
Summary: GCC not emitting deprecated warning on partial
specialization with [[deprecated]] attribute
Product: gcc
Version: 15.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
The following programd doesn't emit warning with gcc but does with clang. Demo:
https://godbolt.org/z/hx6sPnhf1
```
#include <type_traits>
#include <cstdint>
template<typename T, typename U = void>
class Foo {};
template<typename T>
class [[deprecated("do not use this specialization of Foo")]] Foo<T, int> {};
void use(void*);
void testNoWarning() {
Foo<int> a;
use(&a);
}
void testNoWarningOtherType() {
Foo<int, char> a;
use(&a);
};
#ifndef DO_NOT_TEST_WARNING
void testTriggerWarning() {
Foo<double, int> a;
use(&a);
}
#endif
```
For reference, the program is a modified version of the question posted on SO:
https://stackoverflow.com/a/79883723/12002570