1 // Bug c++/83871 - wrong code due to attributes on distinct template
3 // Test to verify that an explicit function template specifialization
4 // does not "inherit" attribute nonnull from an argument declared with
5 // one in the primary template.
7 // { dg-options "-O -Wall" }
10 void __attribute__ ((nonnull (1)))
15 f<int>(int*, int*, int*); // { dg-warning "may be missing attributes" }
18 void __attribute__ ((nonnull (3)))
19 f<float>(float*, float*, float*);
22 void test_nonnull (void)
24 f<void>(0, 0, 0); // { dg-warning "null argument where non-null required \\\(argument 1\\\)" }
26 f<int>(0, 0, 0); // { dg-bogus "null argument" }
29 // { dg-bogus "null argument where non-null required \\\(argument 1\\\)" "" { target *-*-* } .-1 }
30 // { dg-warning "null argument where non-null required \\\(argument 3\\\)" "" { target *-*-* } .-2 }