diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-07 13:09:13 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-07 13:09:13 +0000 |
commit | 1ab90fd18c01a4f84786ecd78188605ecd0f5424 (patch) | |
tree | 19930c3b7b4a189d635db87f0d506aea3310f221 /gcc/testsuite/g++.dg/init | |
parent | 0822e32eed2c2f3aaf3b8ec63ee16772b2b970b2 (diff) | |
download | gcc-1ab90fd18c01a4f84786ecd78188605ecd0f5424.tar.gz |
2011-02-07 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 169877 [probably!]
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@169882 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/init')
-rw-r--r-- | gcc/testsuite/g++.dg/init/const6.C | 27 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/placement4.C | 32 |
2 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/const6.C b/gcc/testsuite/g++.dg/init/const6.C new file mode 100644 index 00000000000..e626bfeaceb --- /dev/null +++ b/gcc/testsuite/g++.dg/init/const6.C @@ -0,0 +1,27 @@ +// PR c++/36688 +// { dg-do run } +// { dg-options "-O2" } + +struct S +{ + long long a; + long long b; + long long c; +}; + +struct T +{ + S g; + long long h[12]; +}; + +static const S s = { 1, 2, 3 }; +static const T t = { s, 0 }; + +int +main () +{ + T x = t; + if (__builtin_memcmp (&x, &t, sizeof (T))) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/init/placement4.C b/gcc/testsuite/g++.dg/init/placement4.C new file mode 100644 index 00000000000..9c61eca2b04 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/placement4.C @@ -0,0 +1,32 @@ +// PR c++/34158 + +typedef __SIZE_TYPE__ size_t; +extern "C" void* malloc (size_t); +extern "C" void free (void *); + +template <class T> class undef; + +struct A { + A() { throw 1; } +}; + +template<typename T> class Pool { }; + +void *operator new(size_t size,Pool<int>& pool) +{ + return malloc(size); +} + +template<typename T> +void operator delete(void *p,Pool<T>& pool) +{ + undef<T> t; // { dg-error "incomplete" } + free(p); +} + +int main () +{ + Pool<int> pool; + new (pool) A(); // { dg-message "instantiated" } + return 0; +} |