1 /* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda
2 { dg-do compile { target c++11 } }
3 { dg-options "-O0 -Wall -fsanitize=undefined" } */
5 #define NONNULL __attribute__ ((nonnull))
7 typedef int F (const char *);
9 NONNULL int f (const char *);
13 return static_cast<F*>([](const char *s){ return f (s); })("O0");
14 // { dg-bogus "\\\[-Wnonnull" "" { target *-*-* } .-1 }
19 return static_cast<F*>([] NONNULL (const char *){ return 0; })(0);
20 // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 }
25 return static_cast<F*>([](const char *s){ return f (s); })(0);
26 // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 }