| 1 |
// Bug c++/83871 - wrong code due to attributes on distinct template |
| 2 |
// specializations |
| 3 |
// Test to verify that an explicit template specifialization does not |
| 4 |
// "inherit" attribute deprecated from a primary template declared |
| 5 |
// with it. |
| 6 |
// { dg-do compile } |
| 7 |
// { dg-options "-Wall -fdump-tree-optimized" } |
| 8 |
|
| 9 |
struct Special; |
| 10 |
|
| 11 |
template <class T> |
| 12 |
void fdeprecated_primary (); |
| 13 |
|
| 14 |
// The primary isn't deprecated at this point so the declaration |
| 15 |
// of its specialization should not be diagnosed. |
| 16 |
template <> |
| 17 |
void fdeprecated_primary<Special> (); // { dg-bogus "deprecated" } |
| 18 |
|
| 19 |
template <class T> |
| 20 |
void __attribute__ ((deprecated)) |
| 21 |
fdeprecated_primary (); |
| 22 |
|
| 23 |
void use_primary () |
| 24 |
{ |
| 25 |
// Verify that uses of the now deprecacted primary are diagnosed. |
| 26 |
fdeprecated_primary<void>(); // { dg-warning "deprecated" "bug 84542" } |
| 27 |
fdeprecated_primary<int>(); // { dg-warning "deprecated" "bug 84542" } |
| 28 |
} |
| 29 |
|
| 30 |
void use_special () |
| 31 |
{ |
| 32 |
// Verify that the use of the non-deprecated specializatoin |
| 33 |
// is not diagnosed. |
| 34 |
fdeprecated_primary<Special>(); |
| 35 |
} |