repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
expr
/
anew4.C
blob
8999ffb53c6d7162f2b5f597d1697ea9c8e28953
1
// { dg-do run }
2
// PR 11228: array operator new, with zero-initialization and a variable sized array.
3
// Regression test for PR
4
// Author: Matt Austern <austern@apple.com>
5
6
struct B
7
{
8
B();
9
int n;
10
};
11
12
B::B()
13
{
14
n = 137;
15
}
16
17
18
struct D : public B
19
{
20
double x;
21
};
22
23
24
D* allocate(int n)
25
{
26
return new D[n]();
27
}
28
29
int main()
30
{
31
const int n = 17;
32
D* p = allocate(n);
33
for (int i = 0; i < n; ++i)
34
if (p[i].n != 137 || p[i].x != 0)
35
return 1;
36
return 0;
37
}