diff options
author | Jason Merrill <jason@redhat.com> | 2010-11-01 21:31:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-11-01 21:31:50 -0400 |
commit | 900484dee595d91a71c7ae63734c199bd137afc6 (patch) | |
tree | a81889fc318d20d599750c915656f1365ed5f443 /gcc | |
parent | 2bfe0527cd744a6f526fe11dd6c11ab39ad0a653 (diff) | |
download | gcc-900484dee595d91a71c7ae63734c199bd137afc6.zip gcc-900484dee595d91a71c7ae63734c199bd137afc6.tar.gz gcc-900484dee595d91a71c7ae63734c199bd137afc6.tar.bz2 |
initializer_list: Decorate with constexpr.
* libsupc++/initializer_list: Decorate with constexpr.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r166170
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C | 12 |
3 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 90aca23..8fc1d6b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,9 @@ 2010-11-01 Jason Merrill <jason@redhat.com> Benjamin Kosnik <bkoz@redhat.com> + * g++.dg/cpp0x/constexpr-initlist2.C: New. + * g++.dg/cpp0x/constexpr-initlist3.C: New. + * g++.dg/cpp0x/constexpr-array-ptr.C: New. * g++.dg/cpp0x/constexpr-array-ptr2.C: New. * g++.dg/cpp0x/constexpr-array-ptr3.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C new file mode 100644 index 0000000..f34b980 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C @@ -0,0 +1,10 @@ +// { dg-options -std=c++0x } + +#include <initializer_list> + +constexpr auto list = { 1, 2, 3, 4 }; + +#define SA(X) static_assert(X, #X) +SA(list.size() == 4); +SA(list.begin()[2] == 3); +SA(list.end()[-1] == 4); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C new file mode 100644 index 0000000..7620e6b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +#include <initializer_list> +#define SA(X) static_assert(X,#X) + +constexpr int f(std::initializer_list<int> l) { return l.begin()[0]; } + +int main() +{ + constexpr int i = f({42}); + SA(i==42); +} |