diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-15 11:24:46 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-15 11:24:46 +0000 |
commit | 56fcd3fede0e1c4489a3c108d95fd1ff38dfa1a5 (patch) | |
tree | f21ec6dd55e434aff16e698b0286153465775d62 /gcc/testsuite/g++.dg/cpp0x | |
parent | c2ce85c4e04bda844aa35dfdf41e69e585d97b2e (diff) | |
download | gcc-56fcd3fede0e1c4489a3c108d95fd1ff38dfa1a5.tar.gz |
2009-07-15 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 149655
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@149682 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype17.C | 29 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist20.C | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist21.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/rv10.C | 15 |
4 files changed, 79 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype17.C b/gcc/testsuite/g++.dg/cpp0x/decltype17.C new file mode 100644 index 00000000000..3c98105fced --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype17.C @@ -0,0 +1,29 @@ +// PR c++/36628 +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include <typeinfo> +#include <string.h> + +int rvalue(); +int& lvalueref(); +int&& rvalueref(); + +decltype(true ? rvalue() : rvalue()) f() +{} + +decltype(true ? lvalueref() : lvalueref()) g() +{} + +decltype(true ? rvalueref() : rvalueref()) h() +{} + +int main() +{ + if (strcmp (typeid(f).name(), "FivE") != 0) + return 1; + if (strcmp (typeid(g).name(), "FRivE") != 0) + return 2; + if (strcmp (typeid(h).name(), "FivE") != 0) + return 3; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist20.C b/gcc/testsuite/g++.dg/cpp0x/initlist20.C new file mode 100644 index 00000000000..fcdb73f190c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist20.C @@ -0,0 +1,17 @@ +// PR c++/40689 +// { dg-options "-std=c++0x" } + +class X +{ + public: + X(): data {1,2,3,4,5} {} + private: + const short data[5]; +}; + +int main() +{ + const float * pData = new const float[4] { 1.5, 2.5, 3.5, 4.5 }; + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist21.C b/gcc/testsuite/g++.dg/cpp0x/initlist21.C new file mode 100644 index 00000000000..9412a085170 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist21.C @@ -0,0 +1,18 @@ +// PR c++/40689 +// { dg-options "-std=c++0x" } + +class X +{ + public: + X(): data {1,2} {} // { dg-error "too many initializers" } + private: + const short data[1]; +}; + +int f(int n) +{ + const float * pData = new const float[1] { 1.5, 2.5 }; // { dg-error "too many initializers" } + pData = new const float[n] { 1.5, 2.5 }; // { dg-warning "array size" } + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/rv10.C b/gcc/testsuite/g++.dg/cpp0x/rv10.C new file mode 100644 index 00000000000..5e78b1dbb69 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv10.C @@ -0,0 +1,15 @@ +// { dg-options "-std=gnu++0x" } + +struct A +{ + A() = default; + A(const A&) = delete; +}; + +A&& f(); +void h(A&&); +void g() +{ + A&& arr = f(); + h(f()); +} |