Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp2a/constexpr-new2.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
rev | line source |
---|---|
145 | 1 // P0784R7 |
2 // { dg-do compile { target c++2a } } | |
3 // { dg-additional-options "-fdelete-null-pointer-checks" } | |
4 | |
5 template <int N> | |
6 constexpr bool | |
7 foo (const char (&x)[N]) | |
8 { | |
9 int **p = new int *[N]; | |
10 for (int i = 0; i < N; i++) | |
11 p[i] = new int (x[i]); | |
12 for (int i = 0; i < N; i++) | |
13 if (*p[i] != x[i]) | |
14 return false; | |
15 for (int i = 0; i < N; ++i) | |
16 delete p[i]; | |
17 delete[] p; | |
18 return true; | |
19 } | |
20 | |
21 constexpr bool a = foo ("foobar"); | |
22 static_assert (a); |