comparison gcc/testsuite/g++.dg/cpp1y/constexpr-new.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // { dg-do compile { target c++14 } }
2
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 }
9 }
10 static_assert(f4(true) == nullptr, "");
11 static_assert(f4(false) == nullptr, ""); // { dg-error "non-constant condition" }