Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/ext/attr-nonnull.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // Bug c++/83871 - wrong code due to attributes on distinct template | |
2 // specializations | |
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. | |
6 // { dg-do compile } | |
7 // { dg-options "-O -Wall" } | |
8 | |
9 template <class T> | |
10 void __attribute__ ((nonnull (1))) | |
11 f (T*, T*, T*); | |
12 | |
13 template <> | |
14 void | |
15 f<int>(int*, int*, int*); // { dg-warning "may be missing attributes" } | |
16 | |
17 template <> | |
18 void __attribute__ ((nonnull (3))) | |
19 f<float>(float*, float*, float*); | |
20 | |
21 | |
22 void test_nonnull (void) | |
23 { | |
24 f<void>(0, 0, 0); // { dg-warning "null argument where non-null required \\\(argument 1\\\)" } | |
25 | |
26 f<int>(0, 0, 0); // { dg-bogus "null argument" } | |
27 | |
28 f<float>(0, 0, 0); | |
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 } | |
31 } |