Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/g++.dg/warn/Wplacement-new-size-4.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-4.C Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,14 @@ +// PR c++/77804 - Internal compiler error on incorrect initialization of +// new-d array +// { dg-do compile } +// { dg-additional-options "-Wplacement-new -Wvla -Wno-error=vla" } + +void* operator new[] (__SIZE_TYPE__ n, void *p) { return p; } + +int main() +{ + char buf[256]; + unsigned n = 10; + int* p = new (buf) (int[n]); // { dg-warning "non-constant array new length must be specified without parentheses around the type-id" } + // { dg-warning "ISO C\\+\\+ forbids variable length array" "vla warning" { target *-*-* } .-1 } +}