OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
PR c++/41109
[pf3gnuchains/gcc-fork.git]
/
gcc
/
testsuite
/
g++.dg
/
warn
/
Wstrict-aliasing-bogus-placement-new.C
1
/* { dg-do compile } */
2
/* { dg-options "-O2 -Wstrict-aliasing" } */
3
4
inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
5
6
struct Y {
7
Y() {}
8
int i;
9
};
10
11
struct X {
12
X() {}
13
void construct(const Y& y)
14
{
15
new (&m_data[0]) Y(y);
16
}
17
bool initialized;
18
char m_data[sizeof (Y)];
19
};
20
21
void bar(const X&);
22
void foo(Y& y)
23
{
24
X x;
25
x.construct(y);
26
x.initialized = true;
27
bar(x);
28
}
29