[to-be-committed][RISC-V][V3] DCE analysis for extension elimination
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attr-deprecated-2.C
blob6f6c210ddb51ce33d15a6e16e6d116e3e8e1ce26
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" }
9 struct Special;
11 template <class T>
12 void fdeprecated_primary ();
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" }
19 template <class T>
20 void __attribute__ ((deprecated))
21 fdeprecated_primary ();
23 void use_primary ()
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" }
30 void use_special ()
32   // Verify that the use of the non-deprecated specializatoin
33   // is not diagnosed.
34   fdeprecated_primary<Special>();