[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attr-deprecated-2.C
blobbf9041506d1fe2403356d4d61c11c94e5889441a
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" { xfail *-*-* } }
27   fdeprecated_primary<int>();           // { dg-warning "deprecated" "bug 84542" { xfail *-*-* } }
30 void use_special ()
32   // Verify that the use of the non-deprecated specializatoin
33   // is not diagnosed.
34   fdeprecated_primary<Special>();