aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/attr-deprecated-2.C
blob: 6f6c210ddb51ce33d15a6e16e6d116e3e8e1ce26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Bug c++/83871 - wrong code due to attributes on distinct template
// specializations
// Test to verify that an explicit template specifialization does not
// "inherit" attribute deprecated from a primary template declared
// with it.
// { dg-do compile }
// { dg-options "-Wall -fdump-tree-optimized" }

struct Special;

template <class T>
void fdeprecated_primary ();

// The primary isn't deprecated at this point so the declaration
// of its specialization should not be diagnosed.
template <>
void fdeprecated_primary<Special> ();   // { dg-bogus "deprecated" }

template <class T>
void __attribute__ ((deprecated))
fdeprecated_primary ();

void use_primary ()
{
  // Verify that uses of the now deprecacted primary are diagnosed.
  fdeprecated_primary<void>();          // { dg-warning "deprecated" "bug 84542" }
  fdeprecated_primary<int>();           // { dg-warning "deprecated" "bug 84542" }
}

void use_special ()
{
  // Verify that the use of the non-deprecated specializatoin
  // is not diagnosed.
  fdeprecated_primary<Special>();
}