aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2014-10-15 14:20:12 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2014-10-15 14:20:12 +0100
commit327a79a52392f9fec4c92693278fe8d362bc7008 (patch)
tree91268a7a118fc998d81b11263b429ce1b2506561 /libstdc++-v3/testsuite
parentcd9b223aaaf57789f2e68cf6c6e806bc3c2b8de1 (diff)
downloadgcc-327a79a52392f9fec4c92693278fe8d362bc7008.zip
gcc-327a79a52392f9fec4c92693278fe8d362bc7008.tar.gz
gcc-327a79a52392f9fec4c92693278fe8d362bc7008.tar.bz2
complex (complex::real, [...]): Add const.
* include/std/complex (complex::real, complex::imag): Add const. * testsuite/26_numerics/complex/value_operations/constexpr2.cc: New. From-SVN: r216258
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr2.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr2.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr2.cc
new file mode 100644
index 0000000..e85e211
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr2.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++14" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <complex>
+
+int main()
+{
+ constexpr std::complex<int> c{};
+ constexpr auto r __attribute__((unused)) = real(c);
+ constexpr auto i __attribute__((unused)) = imag(c);
+}