1 // Bug c++/83871 - wrong code due to attributes on distinct template
3 // Test to verify that an explicit template specifialization does not
4 // "inherit" attribute warning from a primary template declared with
7 // { dg-options "-Wall" }
11 // Primary has no attributes here.
13 void fwarn_primary ();
15 // Uses of the primary template, including declarations of its
16 // specializations, should not be diagnosed until after it has
17 // been redeclared with attribute warning.
19 void fwarn_primary<Special> ();
21 void use_primary_before_warning ()
23 // Verify that uses of the primary are not diagnosed.
24 fwarn_primary<char>();
25 fwarn_primary<short>();
28 // Redeclare the primary with attribute warning.
30 void __attribute__ ((warning ("primary")))
33 // Attribute warning is special in that it only warns for functions
34 // that are actually used, not those that are only declared.
36 void fwarn_primary<double> ();
38 void use_primary_after_warning ()
40 // Verify that uses of the redeclared primary are diagnosed.
41 fwarn_primary<int>(); // { dg-warning "primary" }
42 fwarn_primary<long>(); // { dg-warning "primary" }
47 // Verify that the use of the specializatoin is not diagnosed.
48 fwarn_primary<Special>();