Debian Codegraph @

gcc/testsuite/g++.dg/cpp26/constexpr-voidptr3.C

raw
1 // CWG 2819 - Cast from null pointer value in a constant expression
2 // { dg-do compile { target c++26 } }
3
4 struct S { int s; };
5
6 constexpr S *
7 foo ()
8 {
9 void *p = nullptr;
10 return static_cast<S *> (p);
11 }
12
13 static_assert (foo () == nullptr);