Fix c++/67371 (issues with throw in constexpr)
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-new.C
blob7241fefc41e5c41cf64b0ca346eb8176b459ef2d
1 // { dg-do compile { target c++14 } }
3 constexpr int *f4(bool b) {
4   if (b) {
5     return nullptr;
6   } else {
7     return new int{42}; // { dg-error "call to non-constexpr" }
8   }
10 static_assert(f4(true) == nullptr, "");
11 static_assert(f4(false) == nullptr, ""); // { dg-error "non-constant condition" }