145
|
1 // PR c++/71302
|
|
2 // { dg-options "-Wzero-as-null-pointer-constant -fdiagnostics-show-caret" }
|
|
3
|
|
4 #include <cstddef>
|
|
5
|
|
6 static void
|
|
7 callee_1 (int param1, const char* param2, int param3) {}
|
|
8
|
|
9 void
|
|
10 test_1 (int param1, const char* param2, int param3)
|
|
11 {
|
|
12 callee_1 (0, 0, 0); // { dg-warning "16: zero as null pointer constant" }
|
|
13 /* { dg-begin-multiline-output "" }
|
|
14 callee_1 (0, 0, 0);
|
|
15 ^
|
|
16 { dg-end-multiline-output "" } */
|
|
17
|
|
18 callee_1 (0, NULL, 0);
|
|
19 }
|
|
20
|
|
21 template <typename T>
|
|
22 void
|
|
23 callee_2 (int param1, T* param2, int param3) {}
|
|
24
|
|
25 void
|
|
26 test_2 (int param1, const char* param2, int param3)
|
|
27 {
|
|
28 callee_2<const char*> (0, 0, 0); // { dg-warning "29: zero as null pointer constant" }
|
|
29 /* { dg-begin-multiline-output "" }
|
|
30 callee_2<const char*> (0, 0, 0);
|
|
31 ^
|
|
32 { dg-end-multiline-output "" } */
|
|
33
|
|
34 callee_2<const char*> (0, NULL, 0);
|
|
35 }
|
|
36
|
|
37 void
|
|
38 test_3 ()
|
|
39 {
|
|
40 const char *msg_a = 0; // { dg-warning "23: zero as null pointer constant" }
|
|
41 /* { dg-begin-multiline-output "" }
|
|
42 const char *msg_a = 0;
|
|
43 ^
|
|
44 { dg-end-multiline-output "" } */
|
|
45
|
|
46 const char *msg_b = NULL;
|
|
47 }
|