Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wnonnull6.C

raw
1 /* PR c++/95984 - Internal compiler error: Error reporting routines re-entered
2 in -Wnonnull on a variadic lambda
3 PR c++/missing -Wnonnull passing nullptr to a nonnull variadic lambda
4 { dg-do compile { target c++14 } }
5 { dg-options "-Wall" } */
6
7 typedef int F (int);
8
9 F* pr95984 ()
10 {
11 // This also triggered the ICE.
12 return [](auto...) { return 0; }; // { dg-bogus "\\\[-Wnonnull" }
13 }
14
15
16 __attribute__ ((nonnull)) void f (int, ...);
17 void ff ()
18 {
19 f (1, nullptr); // { dg-warning "\\\[-Wnonnull" }
20 }
21
22 template <class T> void g (T t)
23 {
24 t (1, nullptr); // { dg-warning "\\\[-Wnonnull" }
25 }
26
27 void gg (void)
28 {
29 g ([](int, auto...) __attribute__ ((nonnull)) { });
30 }
31
32 template <class T> __attribute__ ((nonnull)) void h (T);
33
34 void hh ()
35 {
36 h (nullptr); // { dg-warning "\\\[-Wnonnull" }
37 }