diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2010-11-02 02:35:28 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2010-11-02 02:35:28 +0000 |
commit | 4394642dae0b7d809969a2e9cc9f96923c306f34 (patch) | |
tree | 0e6b797a6c1a23c50603805706926a5eaa2184f1 /libstdc++-v3/testsuite | |
parent | e0aece1f4dc5ca01062f90b1d61e88d3828d9f6f (diff) |
* include/std/chrono: Extend constexpr application.
* testsuite/util/testsuite_common_types.h
(constexpr_default_constructible, constexpr_single_value_constructible)
: Add comments about implied constraints.
* testsuite/20_util/duration/cons/constexpr.cc: Activate all tests.
* testsuite/20_util/time_point/cons/constexpr.cc: Same.
* testsuite/20_util/time_point/requirements/constexpr_functions.cc:
Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust line
numbers.
* testsuite/20_util/time_point_cast/constexpr.cc: New.
* include/std/bitset: Use __SIZEOF_* macros to re-create original
logic instead of slipshod application of
std::numeric_limits<T>::max() macros.
* testsuite/util/testsuite_common_types.h
(constexpr_default_constructible): Modify.
* include/std/chrono: Tested constexpr.
* testsuite/20_util/duration_cast/constexpr.cc: New.
* testsuite/20_util/time_point/cons/constexpr.cc: New.
* testsuite/20_util/duration/cons/constexpr.cc: Add single_value tests.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust
line numbers.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/time_point/cons/constexpr.cc: Add single_value
tests.
* testsuite/20_util/time_point/requirements/constexpr_functions.cc: Add.
* testsuite/util/testsuite_common_types.h: Adjust init.
* include/std/chrono (duration): Remove defaulted constructor,
replace with mem-init list.
* testsuite/20_util/duration/cons/constexpr.cc: Add single value.
* testsuite/20_util/duration/requirements/constexpr_functions.cc:
Add non-static member functions.
* testsuite/20_util/default_delete/cons/constexpr.cc: New, xfail.
* testsuite/20_util/enable_shared_from_this/cons/constexpr.cc: Same.
* testsuite/20_util/shared_ptr/cons/constexpr.cc: Same.
* testsuite/20_util/time_point/requirements/constexpr_functions.cc:
Same.
* testsuite/20_util/unique_ptr/cons/constexpr.cc: Same.
* testsuite/20_util/weak_ptr/cons/constexpr.cc: Same.
* include/std/bitset: Add constexpr as per N3126 draft.
* testsuite/23_containers/bitset/cons/constexpr.cc: New.
* testsuite/23_containers/bitset/requirements/constexpr_functions.cc:
New.
* testsuite/util/testsuite_common_types.h: Reset condition.
* include/bits/random.h: Remove misleading comments.
* include/bits/regex.h: Add constexpr.
* testsuite/28_regex/05_constants/syntax_option_type.cc: Add tests.
* testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc: New.
PR libstdc++/46134
* include/std/chrono: Use default constructor.
* testsuite/util/testsuite_common_types.h
(constexpr_default_constructible): Adjust condition.
PR libstdc++/46133
* include/std/complex: Adjust complex specialization default
constructors for constexpr.
* testsuite/26_numerics/complex/cons/constexpr.cc: Enable tests.
* include/bits/random.h: Adjust for constexpr as per N3126 draft.
* testsuite/26_numerics/random/discard_block_engine/requirements/
constexpr_data.cc: New.
* testsuite/26_numerics/random/discard_block_engine/requirements/
constexpr_functions.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/requirements/
constexpr_functions.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/requirements/
constexpr_data.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/requirements/
constexpr_functions.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
constexpr_data.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
constexpr_functions.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/requirements/
constexpr_data.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/requirements/
constexpr_functions.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
constexpr_data.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
constexpr_functions.cc: New.
* include/bits/stream_iterator.h: Add constexpr as per N3126 draft.
* include/bits/streambuf_iterator.h: Same.
* include/std/complex: Same.
* testsuite/24_iterators/istream_iterator/cons/constexpr.cc: New.
* testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc: New.
* testsuite/26_numerics/complex/cons/constexpr.cc: New.
* testsuite/26_numerics/complex/requirements/constexpr_functions.cc:
New.
* include/bits/char_traits.h: Add constexpr as per N3126 draft.
* testsuite/21_strings/char_traits/requirements/constexpr_functions.cc:
New.
* include/tr1_impl/array: Add constexpr as per N3126 draft.
* testsuite/23_containers/array/requirements/
constexpr_functions.cc: New.
* include/bits/shared_ptr.h: Revert changes.
* include/bits/unique_ptr.h: Same.
* include/std/chrono: Adjust.
* include/tr1_impl/type_traits: Same.
* testsuite/util/testsuite_common_types.h: Add test functors.
* testsuite/20_util/duration/cons/constexpr.cc: New.
* testsuite/20_util/duration/requirements/constexpr_functions.cc: Same.
* testsuite/20_util/pair/cons/constexpr.cc: Same.
* testsuite/20_util/ratio/requirements/constexpr_data.cc: Same.
* testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc: Same.
* testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc: Same.
* testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc: Same.
* testsuite/30_threads/call_once/constexpr.cc: Same.
* testsuite/30_threads/mutex/cons/constexpr.cc: Same.
* testsuite/30_threads/once_flag/cons/constexpr.cc: Same.
* testsuite/tr1/4_metaprogramming/integral_constant/requirements/
constexpr_data.cc: Same.
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
* include/bits/allocator.h: Add constexpr as per N3126 draft.
* include/bits/ios_base.h: Same.
* include/bits/shared_ptr.h: Same.
* include/bits/unique_ptr.h: Same.
* include/bits/stl_iterator.h: Same.
* include/bits/stl_pair.h: Same.
* include/std/tuple: Same.
* include/tr1_impl/type_traits: Same.
* include/std/chrono: Same.
* include/std/ratio: Same.
* include/std/mutex: Same.
* src/mutex.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* doc/doxygen/user.cfg.in: Replace _GLIBCXX_USE_CONSTEXPR,
_GLIBCXX_CONSTEXPR for doxygen generation.
* src/limits.cc: Undef.
* testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust.
* testsuite/29_atomics/atomic_address/cons/constexpr.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.c: Same.
* testsuite/18_support/numeric_limits/constexpr.cc: To...
* testsuite/18_support/numeric_limits/requirements/
constexpr_data.cc, constexpr_functions.cc: ...this
* testsuite/util/testsuite_common_types.h
(constexpr_single_value_constructible): Add.
* testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust name.
* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
* testsuite/29_atomics/atomic_address/cons/constexpr.cc: New.
* testsuite/18_support/numeric_limits/constexpr.cc: New.
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
* testsuite/29_atomics/atomic/cons/constexpr.cc: Same.
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: Same.
* include/bits/c++config (_GLIBCXX_CONSTEXPR): Add.
(_GLIBCXX_USE_CONSTEXPR): Add.
* include/std/limits: Use it.
* src/limits.cc: Adjust.
* testsuite/ext/profile/mutex_extensions.cc: Change line number.
* include/bits/atomic_0.h: Rework for N3126 draft, add constexpr.
* include/bits/atomic_2.h: Same.
* include/bits/atomic_base.h: Same.
* include/std/atomic: Same.
* src/atomic.cc: Same.
* include/bits/atomicfwd_c.h: Remove.
* include/bits/atomicfwd_cxx.h: Remove.
* include/c_compatibility/stdatomic.h: Remove.
* include/Makefile.am: Remove atomicfwd_c.h, atomicfwd_cxx.h,
stdatomic.h.
* include/Makefile.in: Regenerate.
* doc/xml/manual/using.xml: Update list of header files for changes.
* testsuite/util/testsuite_common_types.h
(constexpr_constructible): Add.
* testsuite/29_atomics/atomic/cons/constexpr.cc: New.
* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: New.
* testsuite/17_intro/headers/c++200x/stdc++.cc: Modify.
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_flag/cons/1.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
* testsuite/29_atomics/headers/atomic/macros.cc: Same.
* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Same.
* testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Same.
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Remove.
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same.
* testsuite/29_atomics/atomic_flag/clear/1.c: Same.
* testsuite/29_atomics/headers/stdatomic.h/debug_mode.c: Same.
* testsuite/29_atomics/headers/stdatomic.h/functions.c: Same.
* testsuite/29_atomics/headers/stdatomic.h/macros.c: Same.
* testsuite/29_atomics/headers/stdatomic.h/types.c: Same.
* testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.16.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@166171 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
72 files changed, 2271 insertions, 288 deletions
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc index f3e19f5003b..357373a0a82 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc @@ -3,7 +3,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010 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 @@ -44,7 +44,6 @@ #include <math.h> #include <setjmp.h> #include <signal.h> -#include <stdatomic.h> #include <stdarg.h> #ifdef _GLIBCXX_HAVE_STDBOOL_H #include <stdbool.h> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default.cc index 1ab92948416..6b492569c3d 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default.cc @@ -1,6 +1,4 @@ -// { dg-options "-x c -shared-libgcc -lstdc++" } - -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 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 @@ -17,14 +15,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <stdatomic.h> +#include <limits> +#include <testsuite_common_types.h> int main() { - atomic_flag af = ATOMIC_FLAG_INIT; - - if (!atomic_flag_test_and_set(&af)) - atomic_flag_clear(&af); - + __gnu_test::default_constructible test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl()); return 0; } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default_c++0x.cc index 025fdcb08e5..17ee4c79e87 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/cons/default_c++0x.cc @@ -1,6 +1,6 @@ -// { dg-options "-x c -shared-libgcc -lstdc++" } +// { dg-options "-std=gnu++0x" } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 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 @@ -17,14 +17,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <stdatomic.h> +#include <limits> +#include <testsuite_common_types.h> int main() { - atomic_flag af = ATOMIC_FLAG_INIT; - - if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire)) - atomic_flag_clear_explicit(&af, memory_order_release); - + __gnu_test::default_constructible test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl()); return 0; } diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc new file mode 100644 index 00000000000..d5f3b3f3926 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_data.cc @@ -0,0 +1,75 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <limits> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + using std::float_denorm_style; + using std::float_round_style; + constexpr bool v1(_Ttesttype::is_specialized); + constexpr int v2(_Ttesttype::digits); + constexpr int v3(_Ttesttype::digits10); + constexpr int v4(_Ttesttype::max_digits10); + constexpr bool v5(_Ttesttype::is_signed); + constexpr bool v6(_Ttesttype::is_integer); + constexpr bool v7(_Ttesttype::is_exact); + constexpr int v8(_Ttesttype::radix); + constexpr int v9(_Ttesttype::min_exponent); + constexpr int v10(_Ttesttype::min_exponent10); + constexpr int v11(_Ttesttype::max_exponent); + constexpr int v12(_Ttesttype::max_exponent10); + constexpr bool v13(_Ttesttype::has_infinity); + constexpr bool v14(_Ttesttype::has_quiet_NaN); + constexpr bool v15(_Ttesttype::has_signaling_NaN); + constexpr float_denorm_style v16(_Ttesttype::has_denorm); + constexpr bool v17(_Ttesttype::has_denorm_loss); + constexpr bool v18(_Ttesttype::is_iec559); + constexpr bool v19(_Ttesttype::is_bounded); + constexpr bool v20(_Ttesttype::is_modulo); + constexpr bool v21(_Ttesttype::traps); + constexpr bool v22(_Ttesttype::tinyness_before); + constexpr float_round_style v23(_Ttesttype::round_style); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + __gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl()); + return 0; +} diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..7c4852b2bbb --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/requirements/constexpr_functions.cc @@ -0,0 +1,61 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <limits> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype, typename _Tbasetype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr _Tbasetype v1(_Ttesttype::min()); + constexpr _Tbasetype v2(_Ttesttype::max()); + constexpr _Tbasetype v3(_Ttesttype::lowest()); + constexpr _Tbasetype v4(_Ttesttype::epsilon()); + constexpr _Tbasetype v5(_Ttesttype::round_error()); + constexpr _Tbasetype v6(_Ttesttype::infinity()); + constexpr _Tbasetype v7(_Ttesttype::quiet_NaN()); + constexpr _Tbasetype v8(_Ttesttype::signaling_NaN()); + constexpr _Tbasetype v9(_Ttesttype::denorm_min()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + __gnu_cxx::typelist::apply_generator(test, + __gnu_test::limits_tl(), + __gnu_test::integral_types::type()); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc new file mode 100644 index 00000000000..897394a57b2 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/default_delete/cons/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile { xfail *-*-* } } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <memory> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::default_delete<int>>(); // { dg-excess-errors "" } + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc new file mode 100644 index 00000000000..6f78dbb37e3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <chrono> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::chrono::seconds>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::chrono::seconds, std::chrono::seconds::rep>(); + test2.operator()<std::chrono::minutes, std::chrono::hours>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..3986659f064 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/constexpr_functions.cc @@ -0,0 +1,58 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <chrono> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + constexpr auto v3(_Ttesttype::zero()); + + constexpr _Ttesttype obj { }; + constexpr auto v4 = obj.count(); + constexpr auto v5 = -obj; + constexpr auto v6 = +obj; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + test.operator()<std::chrono::nanoseconds>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc index 98a35f10539..7dab6f12977 100644 --- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc @@ -3,7 +3,7 @@ // { dg-require-cstdint "" } // 2008-07-31 Chris Fairles <chris.fairles@gmail.com> -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 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 @@ -31,5 +31,5 @@ void test01() test_type d; } -// { dg-error "rep cannot be a duration" "" { target *-*-* } 203 } +// { dg-error "rep cannot be a duration" "" { target *-*-* } 210 } // { dg-error "instantiated from here" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc index b83bf494db5..640574991bf 100644 --- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc @@ -32,6 +32,6 @@ void test01() test_type d; } -// { dg-error "must be a specialization of ratio" "" { target *-*-* } 204 } +// { dg-error "must be a specialization of ratio" "" { target *-*-* } 211 } // { dg-error "instantiated from here" "" { target *-*-* } 32 } // { dg-excess-errors "In instantiation of" } diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc index 86f349319f0..d6163867fb5 100644 --- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc @@ -33,5 +33,5 @@ void test01() test_type d; } -// { dg-error "period must be positive" "" { target *-*-* } 206 } +// { dg-error "period must be positive" "" { target *-*-* } 213 } // { dg-error "instantiated from here" "" { target *-*-* } 33 } diff --git a/libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc b/libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc new file mode 100644 index 00000000000..a68aed6d45d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/duration_cast/constexpr.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <chrono> +#include <testsuite_common_types.h> + +int main() +{ + using namespace std::chrono; + + // non-constexpr + minutes mn1(6000); + hours hr1 = duration_cast<hours>(mn1); + + // constexpr + constexpr minutes mn2(6000); + constexpr hours hr2 = duration_cast<hours>(mn2); + + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc index 3fd2f2c799d..0df6dcf3896 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/clear/1.c +++ b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc @@ -1,6 +1,7 @@ -// { dg-options "-x c -shared-libgcc -lstdc++" } +// { dg-do compile { xfail *-*-* } } +// { dg-options "-std=gnu++0x" } -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2010 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 @@ -17,18 +18,18 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <cassert> -#include <stdatomic.h> +#include <memory> +#include <testsuite_common_types.h> -// libstdc++/40826 -// libstdc++/40654 -int main() +struct derived : public std::enable_shared_from_this<int> { - atomic_flag f = ATOMIC_FLAG_INIT; - - atomic_flag_clear(&f); // set to false - assert( false == atomic_flag_test_and_set(&f) ); // return previous false, set to true - assert( true == atomic_flag_test_and_set(&f) ); // return true + constexpr derived() { } +}; +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<derived>(); // { dg-excess-errors "" } + derived d; return 0; } diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc index d56937678e2..7bf6b71162d 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c +++ b/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc @@ -1,7 +1,7 @@ -// { dg-options "-x c" } // { dg-do compile } +// { dg-options "-std=gnu++0x" } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2010 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 @@ -18,19 +18,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <stdatomic.h> +#include <memory> +#include <testsuite_common_types.h> int main() { - atomic_flag f; - atomic_flag* p = &f; - memory_order m = memory_order_relaxed; - - // For position only. - atomic_flag_test_and_set(p); - atomic_flag_test_and_set_explicit(p, m); - atomic_flag_clear(p); - atomic_flag_clear_explicit(p, m); - + __gnu_test::constexpr_default_constructible test; + test.operator()<std::pair<int, int>>(); return 0; } diff --git a/libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc new file mode 100644 index 00000000000..bc90adce0b0 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/ratio/requirements/constexpr_data.cc @@ -0,0 +1,52 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <ratio> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr intmax_t v1(_Ttesttype::num); + constexpr intmax_t v2(_Ttesttype::den); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + test.operator()<std::ratio<600, 900>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc new file mode 100644 index 00000000000..d040ea49666 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc @@ -0,0 +1,33 @@ +// { dg-do compile { xfail *-*-* } } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <memory> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::shared_ptr<int>>(); // { dg-excess-errors "" } + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::shared_ptr<int>, std::nullptr_t>(); // { dg-excess-errors "" } + + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc new file mode 100644 index 00000000000..d12d2f164c9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/time_point/cons/constexpr.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <chrono> +#include <testsuite_common_types.h> + +int main() +{ + using namespace std::chrono; + + __gnu_test::constexpr_default_constructible test1; + test1.operator()<time_point<system_clock>>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<time_point<system_clock>, seconds>(); + test2.operator()<time_point<system_clock, seconds>, + time_point<system_clock, minutes>>(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..feb77fb17fa --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/time_point/requirements/constexpr_functions.cc @@ -0,0 +1,56 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <chrono> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + + constexpr _Ttesttype obj; + constexpr auto v3 = obj.time_since_epoch(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + using namespace std::chrono; + __gnu_test::constexpr_member_functions test; + test.operator()<time_point<system_clock>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc b/libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc new file mode 100644 index 00000000000..436a4fbfc6c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/time_point_cast/constexpr.cc @@ -0,0 +1,39 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <chrono> +#include <testsuite_common_types.h> + +int main() +{ + using namespace std::chrono; + typedef time_point<system_clock, hours> to_type; + typedef time_point<system_clock, minutes> from_type; + + // constexpr + constexpr minutes m(6000); + constexpr hours h(19); + constexpr to_type tpm(h); // time_point object with minutes + constexpr from_type tph(m); // time_point object with hours + + constexpr auto res(time_point_cast<hours>(tpm)); + + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc new file mode 100644 index 00000000000..20db7615ba8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc @@ -0,0 +1,32 @@ +// { dg-do compile { xfail *-*-* } } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <memory> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::unique_ptr<int>>(); // { dg-excess-errors "" } + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::unique_ptr<int>, std::nullptr_t>(); // { dg-excess-errors "" } + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc index fbb24c002f4..b8cf6d8c08c 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc @@ -42,10 +42,10 @@ main() } // { dg-warning "note" "" { target *-*-* } 347 } -// { dg-warning "note" "" { target *-*-* } 466 } +// { dg-warning "note" "" { target *-*-* } 465 } // { dg-warning "note" "" { target *-*-* } 883 } // { dg-warning "note" "" { target *-*-* } 580 } // { dg-warning "note" "" { target *-*-* } 1027 } // { dg-warning "note" "" { target *-*-* } 340 } // { dg-warning "note" "" { target *-*-* } 290 } -// { dg-warning "note" "" { target *-*-* } 200 } +// { dg-warning "note" "" { target *-*-* } 201 } diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc new file mode 100644 index 00000000000..3b43769bff3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc @@ -0,0 +1,32 @@ +// { dg-do compile { xfail *-*-* } } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <memory> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::weak_ptr<int>>(); // { dg-excess-errors "" } + // test.operator()<std::__weak_ptr<int>>(); + // test.operator()<std::__weak_count<__gnu_cxx::__default_lock_policy>>(); + // test.operator()<std::_Sp_counted_base<__gnu_cxx::__default_lock_policy>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..ecb9a3e243a --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc @@ -0,0 +1,67 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <string> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + typedef typename _Ttesttype::char_type char_type; + typedef typename _Ttesttype::int_type int_type; + const char_type c1(0); + const char_type c2 = c1; + const int_type i(0); + constexpr auto v1(_Ttesttype::eq(c1, c2)); + constexpr auto v2(_Ttesttype::lt(c1, c2)); + constexpr auto v3(_Ttesttype::to_char_type(i)); + constexpr auto v4(_Ttesttype::to_int_type(c1)); + constexpr auto v5(_Ttesttype::eq_int_type(i, i)); + constexpr auto v6(_Ttesttype::eof()); + constexpr auto v7(_Ttesttype::not_eof(i)); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + test.operator()<std::char_traits<char>>(); +#ifdef _GLIBCXX_USE_WCHAR_T + test.operator()<std::char_traits<wchar_t>>(); +#endif + test.operator()<std::char_traits<char16_t>>(); + test.operator()<std::char_traits<char32_t>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..494a8dedd6f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc @@ -0,0 +1,54 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <array> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr _Ttesttype a = { }; + constexpr auto v1 = a.size(); + constexpr auto v2 = a.max_size(); + constexpr auto v3 = a.empty(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + test.operator()<std::array<long, 60>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc new file mode 100644 index 00000000000..aea50301375 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/constexpr.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <bitset> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::bitset<0>>(); + test1.operator()<std::bitset<1>>(); + test1.operator()<std::bitset<256>>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::bitset<0>, unsigned long long>(); + test2.operator()<std::bitset<1>, unsigned long long>(); + test2.operator()<std::bitset<256>, unsigned long long>(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..ac9a07f379c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/bitset/requirements/constexpr_functions.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <bitset> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr _Ttesttype obj; + constexpr auto v1 = obj.size(); + // constexpr auto v2 = obj[4]; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + test.operator()<std::bitset<0>>(); + test.operator()<std::bitset<1>>(); + test.operator()<std::bitset<64>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc new file mode 100644 index 00000000000..20b41997303 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <iterator> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::istream_iterator<char>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc new file mode 100644 index 00000000000..0a6980ec1f0 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <iterator> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::istreambuf_iterator<char, std::char_traits<char>>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc new file mode 100644 index 00000000000..13d3c81685f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::complex<float>>(); + test1.operator()<std::complex<double>>(); + test1.operator()<std::complex<long double>>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::complex<float>, float>(); + test2.operator()<std::complex<double>, double>(); + test2.operator()<std::complex<long double>, long double>(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..74f7bf5515f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc @@ -0,0 +1,57 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + typedef typename _Ttesttype::_ComplexT _ComplexT; + const _ComplexT cc = { 1.1 }; + constexpr _Ttesttype a(cc); + constexpr auto v1 = a.real(); + constexpr auto v2 = a.imag(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + test.operator()<std::complex<float>>(); + test.operator()<std::complex<double>>(); + test.operator()<std::complex<long double>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc new file mode 100644 index 00000000000..7f82bfee55f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc @@ -0,0 +1,57 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::block_size); + constexpr auto v2(_Ttesttype::used_block); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::discard_block_engine + < + std::subtract_with_carry_engine<unsigned long, 24, 10, 24>, + 389, 24 + > type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..faec5bfad2f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc @@ -0,0 +1,57 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::discard_block_engine + < + std::subtract_with_carry_engine<unsigned long, 24, 10, 24>, + 389, 24 + > type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..2b84ec855df --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc @@ -0,0 +1,60 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::independent_bits_engine + < + std::subtract_with_carry_engine + < + uint_fast64_t, 48, 5, 12 + >, + 48, uint_fast64_t + > type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc new file mode 100644 index 00000000000..e7e9fc05311 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::multiplier); + constexpr auto v2(_Ttesttype::increment); + constexpr auto v3(_Ttesttype::modulus); + constexpr auto v4(_Ttesttype::default_seed); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..cff1a67caf1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc @@ -0,0 +1,53 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc new file mode 100644 index 00000000000..17c89e13bf9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc @@ -0,0 +1,65 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::word_size); + constexpr auto v2(_Ttesttype::state_size); + constexpr auto v3(_Ttesttype::shift_size); + constexpr auto v4(_Ttesttype::mask_bits); + constexpr auto v5(_Ttesttype::xor_mask); + constexpr auto v6(_Ttesttype::tempering_u); + constexpr auto v7(_Ttesttype::tempering_d); + constexpr auto v8(_Ttesttype::tempering_s); + constexpr auto v9(_Ttesttype::tempering_b); + constexpr auto v10(_Ttesttype::tempering_t); + constexpr auto v11(_Ttesttype::tempering_c); + constexpr auto v12(_Ttesttype::tempering_l); + constexpr auto v13(_Ttesttype::initialization_multiplier); + constexpr auto v14(_Ttesttype::default_seed); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::mt19937 type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..dd350e7fbd8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc @@ -0,0 +1,53 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::mt19937 type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc new file mode 100644 index 00000000000..8a158fb9a42 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::table_size); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::shuffle_order_engine + < + std::linear_congruential_engine + < + uint_fast32_t,16807UL, 0UL, 2147483647UL + >, + 256 + > type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..65e2e5612d5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc @@ -0,0 +1,60 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::shuffle_order_engine + < + std::linear_congruential_engine + < + uint_fast32_t,16807UL, 0UL, 2147483647UL + >, + 256 + > type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc new file mode 100644 index 00000000000..0b51727b1cd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::word_size); + constexpr auto v2(_Ttesttype::short_lag); + constexpr auto v3(_Ttesttype::long_lag); + constexpr auto v4(_Ttesttype::default_seed); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::ranlux24_base type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc new file mode 100644 index 00000000000..b05710a9e67 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc @@ -0,0 +1,53 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <random> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::min()); + constexpr auto v2(_Ttesttype::max()); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::ranlux24_base type; + test.operator()<type>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc index a7adff4d3f4..8e97d329942 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc @@ -34,5 +34,5 @@ void test01() } // { dg-error "synthesized" "" { target *-*-* } 33 } // { dg-error "within this context" "" { target *-*-* } 26 } -// { dg-error "is private" "" { target *-*-* } 788 } +// { dg-error "is private" "" { target *-*-* } 789 } // { dg-error "operator=" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc index 44f7af87da8..6e527cdc262 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc @@ -34,5 +34,5 @@ void test02() } // { dg-error "within this context" "" { target *-*-* } 26 } // { dg-error "synthesized" "" { target *-*-* } 33 } -// { dg-error "is private" "" { target *-*-* } 785 } +// { dg-error "is private" "" { target *-*-* } 786 } // { dg-error "copy constructor" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc new file mode 100644 index 00000000000..349f7f9f2d0 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc @@ -0,0 +1,28 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <ios> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_bitwise_operators<std::ios_base::fmtflags>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc index a8abfbe929f..fd3ce10553b 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c +++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc @@ -1,7 +1,7 @@ -// { dg-options "-x c -D_GLIBCXX_DEBUG" } // { dg-do compile } +// { dg-options "-std=gnu++0x" } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2010 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 @@ -18,5 +18,11 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// libstdc++/36130 -#include <stdatomic.h> +#include <ios> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_bitwise_operators<std::ios_base::iostate>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc new file mode 100644 index 00000000000..66041b87e1f --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc @@ -0,0 +1,28 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <ios> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_bitwise_operators<std::ios_base::openmode>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc b/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc index 2aebf46d19e..71a11ef2106 100644 --- a/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc +++ b/libstdc++-v3/testsuite/28_regex/05_constants/syntax_option_type.cc @@ -23,29 +23,68 @@ // 28.5.1 #include <regex> -#include <testsuite_hooks.h> void test01() { - bool test __attribute__((unused)) = true; + std::regex_constants::syntax_option_type option { }; + option = option | std::regex_constants::icase; + option = option | std::regex_constants::nosubs; + option = option | std::regex_constants::optimize; + option = option | std::regex_constants::collate; + option = option | std::regex_constants::ECMAScript; + option = option | std::regex_constants::basic; + option = option | std::regex_constants::extended; + option = option | std::regex_constants::awk; + option = option | std::regex_constants::grep; + option = option | std::regex_constants::egrep; +} + +void +test02() +{ + std::regex_constants::syntax_option_type option { }; + option = option & std::regex_constants::icase; + option = option & std::regex_constants::nosubs; + option = option & std::regex_constants::optimize; + option = option & std::regex_constants::collate; + option = option & std::regex_constants::ECMAScript; + option = option & std::regex_constants::basic; + option = option & std::regex_constants::extended; + option = option & std::regex_constants::awk; + option = option & std::regex_constants::grep; + option = option & std::regex_constants::egrep; +} - std::regex_constants::syntax_option_type option = 0; +void +test03() +{ + std::regex_constants::syntax_option_type option { }; + option = ~std::regex_constants::icase; + option = ~std::regex_constants::nosubs; + option = ~std::regex_constants::optimize; + option = ~std::regex_constants::collate; + option = ~std::regex_constants::ECMAScript; + option = ~std::regex_constants::basic; + option = ~std::regex_constants::extended; + option = ~std::regex_constants::awk; + option = ~std::regex_constants::grep; + option = ~std::regex_constants::egrep; +} - option |= std::regex_constants::icase; - option |= std::regex_constants::nosubs; - option |= std::regex_constants::optimize; - option |= std::regex_constants::collate; - option |= std::regex_constants::ECMAScript; - option |= std::regex_constants::basic; - option |= std::regex_constants::extended; - option |= std::regex_constants::awk; - option |= std::regex_constants::grep; - option |= std::regex_constants::egrep; +void +test04_constexpr() +{ + using namespace std::regex_constants; + constexpr auto a1 = icase | awk; + constexpr auto a2 = icase & awk; + constexpr auto a3 = ~grep; } int main() { test01(); + test02(); + test03(); return 0; } diff --git a/libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc new file mode 100644 index 00000000000..7db1bbd5a4a --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc @@ -0,0 +1,61 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <regex> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1(_Ttesttype::icase); + constexpr auto v2(_Ttesttype::nosubs); + constexpr auto v3(_Ttesttype::optimize); + constexpr auto v4(_Ttesttype::collate); + constexpr auto v5(_Ttesttype::ECMAScript); + constexpr auto v6(_Ttesttype::basic); + constexpr auto v7(_Ttesttype::extended); + constexpr auto v8(_Ttesttype::awk); + constexpr auto v9(_Ttesttype::grep); + constexpr auto v10(_Ttesttype::egrep); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + test.operator()<std::regex>(); + test.operator()<std::wregex>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc index 66f5a81a5e5..9272c7eb3da 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc @@ -28,5 +28,5 @@ int main() return 0; } -// { dg-error "ambiguous" "" { target *-*-* } 522 } +// { dg-error "deleted" "" { target *-*-* } 544 } // { dg-prune-output "include" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc new file mode 100644 index 00000000000..875c5490053 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/constexpr.cc @@ -0,0 +1,32 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <atomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_single_value_constructible test; + + // test.operator()<std::atomic<int>, int>(); + __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), + __gnu_test::integral_types::type()); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc index 69b1eff1297..19b3a150c19 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc @@ -28,5 +28,5 @@ int main() return 0; } -// { dg-error "deleted" "" { target *-*-* } 561 } +// { dg-error "deleted" "" { target *-*-* } 583 } // { dg-prune-output "include" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc index 9405e459bf8..fad25935446 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc @@ -26,6 +26,6 @@ void test01() typedef std::atomic_address test_type; test_type t1; test_type t2; - t1 = t2; // { dg-error "ambiguous" } + t1 = t2; // { dg-error "deleted" } } // { dg-prune-output "include" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc new file mode 100644 index 00000000000..6b4963512a4 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <atomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_single_value_constructible test; + test.operator()<std::atomic_address, void*>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc index b7724403412..b91de112650 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/1.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <stdatomic.h> +#include <atomic> void test01() { diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc index 751c6cdc696..12da321abd8 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc @@ -29,5 +29,5 @@ int main() return 0; } -// { dg-error "ambiguous" "" { target *-*-* } 522 } +// { dg-error "deleted" "" { target *-*-* } 544 } // { dg-prune-output "include" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc new file mode 100644 index 00000000000..a91db8d66a0 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/constexpr.cc @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <atomic> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_single_value_constructible test; + __gnu_cxx::typelist::apply_generator(test, + __gnu_test::atomic_integrals::type(), + __gnu_test::integral_types::type()); + return 0; +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc index 976a6991d43..e334f1b0447 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc @@ -29,5 +29,5 @@ int main() return 0; } -// { dg-error "deleted" "" { target *-*-* } 561 } +// { dg-error "deleted" "" { target *-*-* } 583 } // { dg-prune-output "include" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc index 2a112c95838..b2f1ea4e3bf 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc @@ -27,7 +27,7 @@ int main() return 0; } -// { dg-error "operator" "" { target *-*-* } 405 } -// { dg-error "operator" "" { target *-*-* } 406 } -// { dg-error "operator" "" { target *-*-* } 407 } +// { dg-error "operator" "" { target *-*-* } 427 } +// { dg-error "operator" "" { target *-*-* } 428 } +// { dg-error "operator" "" { target *-*-* } 429 } // { dg-excess-errors "In file included from" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc index 974c947e664..dd84c836d9b 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc @@ -28,6 +28,6 @@ int main() return 0; } -// { dg-error "operator" "" { target *-*-* } 376 } -// { dg-error "operator" "" { target *-*-* } 377 } -// { dg-error "operator" "" { target *-*-* } 378 } +// { dg-error "operator" "" { target *-*-* } 384 } +// { dg-error "operator" "" { target *-*-* } 385 } +// { dg-error "operator" "" { target *-*-* } 386 } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc index 4927fcf1854..90b75556d18 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc @@ -28,6 +28,6 @@ int main() return 0; } -// { dg-error "operator" "" { target *-*-* } 354 } -// { dg-error "operator" "" { target *-*-* } 355 } -// { dg-error "operator" "" { target *-*-* } 356 } +// { dg-error "operator" "" { target *-*-* } 362 } +// { dg-error "operator" "" { target *-*-* } 363 } +// { dg-error "operator" "" { target *-*-* } 364 } diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc index c0419c9b8d8..022cd90b250 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 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 @@ -22,24 +22,91 @@ namespace gnu { -#ifndef ATOMIC_INTEGRAL_LOCK_FREE -# error "ATOMIC_INTEGRAL_LOCK_FREE must be a macro" +#ifndef ATOMIC_CHAR_LOCK_FREE +# error "ATOMIC_CHAR_LOCK_FREE must be a macro" #else -# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \ - && ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2 -# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2" +# if ATOMIC_CHAR_LOCK_FREE != 0 \ + && ATOMIC_CHAR_LOCK_FREE != 1 && ATOMIC_CHAR_LOCK_FREE != 2 +# error "ATOMIC_CHAR_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_CHAR16_T_LOCK_FREE +# error "ATOMIC_CHAR16_T_LOCK_FREE must be a macro" +#else +# if ATOMIC_CHAR16_T_LOCK_FREE != 0 \ + && ATOMIC_CHAR16_T_LOCK_FREE != 1 && ATOMIC_CHAR16_T_LOCK_FREE != 2 +# error "ATOMIC_CHAR16_T_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_CHAR32_T_LOCK_FREE +# error "ATOMIC_CHAR32_T_LOCK_FREE must be a macro" +#else +# if ATOMIC_CHAR32_T_LOCK_FREE != 0 \ + && ATOMIC_CHAR32_T_LOCK_FREE != 1 && ATOMIC_CHAR32_T_LOCK_FREE != 2 +# error "ATOMIC_CHAR32_T_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_WCHAR_T_LOCK_FREE +# error "ATOMIC_WCHAR_T_LOCK_FREE must be a macro" +#else +# if ATOMIC_WCHAR_T_LOCK_FREE != 0 \ + && ATOMIC_WCHAR_T_LOCK_FREE != 1 && ATOMIC_WCHAR_T_LOCK_FREE != 2 +# error "ATOMIC_WCHAR_T_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_SHORT_LOCK_FREE +# error "ATOMIC_SHORT_LOCK_FREE must be a macro" +#else +# if ATOMIC_SHORT_LOCK_FREE != 0 \ + && ATOMIC_SHORT_LOCK_FREE != 1 && ATOMIC_SHORT_LOCK_FREE != 2 +# error "ATOMIC_SHORT_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_INT_LOCK_FREE +# error "ATOMIC_INT_LOCK_FREE must be a macro" +#else +# if ATOMIC_INT_LOCK_FREE != 0 \ + && ATOMIC_INT_LOCK_FREE != 1 && ATOMIC_INT_LOCK_FREE != 2 +# error "ATOMIC_INT_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_LONG_LOCK_FREE +# error "ATOMIC_LONG_LOCK_FREE must be a macro" +#else +# if ATOMIC_LONG_LOCK_FREE != 0 \ + && ATOMIC_LONG_LOCK_FREE != 1 && ATOMIC_LONG_LOCK_FREE != 2 +# error "ATOMIC_LONG_LOCK_FREE must be 0, 1, or 2" +# endif +#endif + +#ifndef ATOMIC_LLONG_LOCK_FREE +# error "ATOMIC_LLONG_LOCK_FREE must be a macro" +#else +# if ATOMIC_LLONG_LOCK_FREE != 0 \ + && ATOMIC_LLONG_LOCK_FREE != 1 && ATOMIC_LLONG_LOCK_FREE != 2 +# error "ATOMIC_LLONG_LOCK_FREE must be 0, 1, or 2" # endif #endif #ifndef ATOMIC_ADDRESS_LOCK_FREE # error "ATOMIC_ADDRESS_LOCK_FREE must be a macro" -# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \ - && ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2 -# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2" +# if ATOMIC_ADDRESS_LOCK_FREE != 0 \ + && ATOMIC_ADDRESS_LOCK_FREE != 1 && ATOMIC_ADDRESS_LOCK_FREE != 2 +# error "ATOMIC_ADDRESS_LOCK_FREE must be 0, 1, or 2" # endif #endif #ifndef ATOMIC_FLAG_INIT #error "ATOMIC_FLAG_INIT_must_be_a_macro" #endif + +#ifndef ATOMIC_VAR_INIT + #error "ATOMIC_VAR_INIT_must_be_a_macro" +#endif } diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc index ce1e04359ad..13e4949e9b1 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 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 @@ -69,7 +69,6 @@ void test01() using std::atomic_intptr_t; using std::atomic_uintptr_t; using std::atomic_size_t; - using std::atomic_ssize_t; using std::atomic_ptrdiff_t; using std::atomic_intmax_t; using std::atomic_uintmax_t; diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc index cbdb5e6fcb2..57907734304 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 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 @@ -49,6 +49,29 @@ void test01() using atomic_char16_t; using atomic_char32_t; + using atomic_int_least8_t; + using atomic_uint_least8_t; + using atomic_int_least16_t; + using atomic_uint_least16_t; + using atomic_int_least32_t; + using atomic_uint_least32_t; + using atomic_int_least64_t; + using atomic_uint_least64_t; + using atomic_int_fast8_t; + using atomic_uint_fast8_t; + using atomic_int_fast16_t; + using atomic_uint_fast16_t; + using atomic_int_fast32_t; + using atomic_uint_fast32_t; + using atomic_int_fast64_t; + using atomic_uint_fast64_t; + using atomic_intptr_t; + using atomic_uintptr_t; + using atomic_size_t; + using atomic_ptrdiff_t; + using atomic_intmax_t; + using atomic_uintmax_t; + using atomic_address; } @@ -76,3 +99,72 @@ void test01() // { dg-error "expected nested-name-specifier" "" { target *-*-* } 49 } // { dg-error "expected nested-name-specifier" "" { target *-*-* } 50 } // { dg-error "expected nested-name-specifier" "" { target *-*-* } 52 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 53 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 54 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 55 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 56 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 57 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 58 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 59 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 60 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 61 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 62 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 63 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 64 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 65 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 66 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 67 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 68 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 69 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 70 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 71 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 72 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 73 } +// { dg-error "expected nested-name-specifier" "" { target *-*-* } 75 } + +// { dg-error "declared" "" { target *-*-* } 26 } +// { dg-error "declared" "" { target *-*-* } 27 } +// { dg-error "declared" "" { target *-*-* } 28 } +// { dg-error "declared" "" { target *-*-* } 29 } +// { dg-error "declared" "" { target *-*-* } 30 } +// { dg-error "declared" "" { target *-*-* } 31 } +// { dg-error "declared" "" { target *-*-* } 32 } +// { dg-error "declared" "" { target *-*-* } 34 } +// { dg-error "declared" "" { target *-*-* } 36 } +// { dg-error "declared" "" { target *-*-* } 37 } +// { dg-error "declared" "" { target *-*-* } 38 } +// { dg-error "declared" "" { target *-*-* } 39 } +// { dg-error "declared" "" { target *-*-* } 40 } +// { dg-error "declared" "" { target *-*-* } 41 } +// { dg-error "declared" "" { target *-*-* } 42 } +// { dg-error "declared" "" { target *-*-* } 43 } +// { dg-error "declared" "" { target *-*-* } 44 } +// { dg-error "declared" "" { target *-*-* } 45 } +// { dg-error "declared" "" { target *-*-* } 46 } +// { dg-error "declared" "" { target *-*-* } 47 } +// { dg-error "declared" "" { target *-*-* } 48 } +// { dg-error "declared" "" { target *-*-* } 49 } +// { dg-error "declared" "" { target *-*-* } 50 } +// { dg-error "declared" "" { target *-*-* } 52 } +// { dg-error "declared" "" { target *-*-* } 53 } +// { dg-error "declared" "" { target *-*-* } 54 } +// { dg-error "declared" "" { target *-*-* } 55 } +// { dg-error "declared" "" { target *-*-* } 56 } +// { dg-error "declared" "" { target *-*-* } 57 } +// { dg-error "declared" "" { target *-*-* } 58 } +// { dg-error "declared" "" { target *-*-* } 59 } +// { dg-error "declared" "" { target *-*-* } 60 } +// { dg-error "declared" "" { target *-*-* } 61 } +// { dg-error "declared" "" { target *-*-* } 62 } +// { dg-error "declared" "" { target *-*-* } 63 } +// { dg-error "declared" "" { target *-*-* } 64 } +// { dg-error "declared" "" { target *-*-* } 65 } +// { dg-error "declared" "" { target *-*-* } 66 } +// { dg-error "declared" "" { target *-*-* } 67 } +// { dg-error "declared" "" { target *-*-* } 68 } +// { dg-error "declared" "" { target *-*-* } 69 } +// { dg-error "declared" "" { target *-*-* } 70 } +// { dg-error "declared" "" { target *-*-* } 71 } +// { dg-error "declared" "" { target *-*-* } 72 } +// { dg-error "declared" "" { target *-*-* } 73 } +// { dg-error "declared" "" { target *-*-* } 75 } diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c deleted file mode 100644 index 7d6992e4a38..00000000000 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c +++ /dev/null @@ -1,114 +0,0 @@ -// { dg-options "-x c" } -// { dg-do compile } - -// Copyright (C) 2008, 2009 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 <stdatomic.h> - -int main() -{ -#ifndef ATOMIC_INTEGRAL_LOCK_FREE - #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro" -#endif - -#ifndef ATOMIC_ADDRESS_LOCK_FREE - #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro" -#endif - -#ifndef ATOMIC_FLAG_INIT - #error "ATOMIC_FLAG_INIT_must_be_a_macro" -#endif - -#ifndef atomic_is_lock_free - #error "atomic_is_lock_free_must_be_a_macro" -#endif - -#ifndef atomic_load - #error "atomic_load_must_be_a_macro" -#endif - -#ifndef atomic_load_explicit - #error "atomic_load_explicit_must_be_a_macro" -#endif - -#ifndef atomic_store_explicit - #error "atomic_store_explicit_must_be_a_macro" -#endif - -#ifndef atomic_store - #error "atomic_store_must_be_a_macro" -#endif - -#ifndef atomic_exchange_explicit - #error "atomic_exchange_explicit_must_be_a_macro" -#endif - -#ifndef atomic_exchange - #error "atomic_exchange_must_be_a_macro" -#endif - -#ifndef atomic_compare_exchange - #error "atomic_compare_exchange_must_be_a_macro" -#endif - -#ifndef atomic_compare_exchange_explicit - #error "atomic_compare_exchange_explicit_must_be_a_macro" -#endif - -#ifndef atomic_fetch_add_explicit - #error "atomic_fetch_add_explicit_must_be_a_macro" -#endif - -#ifndef atomic_fetch_add - #error "atomic_fetch_add_must_be_a_macro" -#endif - -#ifndef atomic_fetch_sub_explicit - #error "atomic_fetch_sub_explicit_must_be_a_macro" -#endif - -#ifndef atomic_fetch_sub - #error "atomic_fetch_sub_must_be_a_macro" -#endif - -#ifndef atomic_fetch_and_explicit - #error "atomic_fetch_and_explicit_must_be_a_macro" -#endif - -#ifndef atomic_fetch_and - #error "atomic_fetch_and_must_be_a_macro" -#endif - -#ifndef atomic_fetch_or_explicit - #error "atomic_fetch_or_explicit_must_be_a_macro" -#endif - -#ifndef atomic_fetch_or - #error "atomic_fetch_or_must_be_a_macro" -#endif - -#ifndef atomic_fetch_xor_explicit - #error "atomic_fetch_xor_explicit_must_be_a_macro" -#endif - -#ifndef atomic_fetch_xor - #error "atomic_fetch_xor_must_be_a_macro" -#endif - - return 0; -} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c deleted file mode 100644 index 48d6d926759..00000000000 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c +++ /dev/null @@ -1,77 +0,0 @@ -// { dg-options "-x c" } -// { dg-do compile } - -// Copyright (C) 2008, 2009 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 <stdatomic.h> - -void test01() -{ - typedef memory_order t_01; - memory_order t_02 __attribute__((unused)) = memory_order_relaxed; - memory_order t_03 __attribute__((unused)) = memory_order_acquire; - memory_order t_04 __attribute__((unused)) = memory_order_release; - memory_order t_05 __attribute__((unused)) = memory_order_acq_rel; - memory_order t_06 __attribute__((unused)) = memory_order_seq_cst; - - typedef atomic_flag t_07; - - // atomics for builtins types - typedef atomic_bool t_08; - typedef atomic_char t_09; - typedef atomic_schar t_10; - typedef atomic_uchar t_11; - typedef atomic_short t_12; - typedef atomic_ushort t_13; - typedef atomic_int t_14; - typedef atomic_uint t_15; - typedef atomic_long t_16; - typedef atomic_ulong t_17; - typedef atomic_llong t_18; - typedef atomic_ullong t_19; - typedef atomic_wchar_t t_20; - typedef atomic_char16_t t_21; - typedef atomic_char32_t t_22; - - // atomics for standard typedefs - typedef atomic_int_least8_t t_23; - typedef atomic_uint_least8_t t_24; - typedef atomic_int_least16_t t_25; - typedef atomic_uint_least16_t t_26; - typedef atomic_int_least32_t t_27; - typedef atomic_uint_least32_t t_28; - typedef atomic_int_least64_t t_29; - typedef atomic_uint_least64_t t_30; - typedef atomic_int_fast8_t t_31; - typedef atomic_uint_fast8_t t_32; - typedef atomic_int_fast16_t t_33; - typedef atomic_uint_fast16_t t_34; - typedef atomic_int_fast32_t t_35; - typedef atomic_uint_fast32_t t_36; - typedef atomic_int_fast64_t t_37; - typedef atomic_uint_fast64_t t_38; - typedef atomic_intptr_t t_39; - typedef atomic_uintptr_t t_40; - typedef atomic_size_t t_41; - typedef atomic_ssize_t t_42; - typedef atomic_ptrdiff_t t_43; - typedef atomic_intmax_t t_44; - typedef atomic_uintmax_t t_45; - - typedef atomic_address t_46; -} diff --git a/libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc b/libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc new file mode 100644 index 00000000000..9518b72ea92 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/call_once/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <mutex> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::mutex>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc new file mode 100644 index 00000000000..9518b72ea92 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <mutex> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::mutex>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc b/libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc new file mode 100644 index 00000000000..52f3b5d3d4d --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/once_flag/cons/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <mutex> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; + test.operator()<std::once_flag>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc index 471c4482b2d..7f8072427ca 100644 --- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc +++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions.cc @@ -22,4 +22,4 @@ #include <vector> -// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 196 } +// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 223 } diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/constexpr_data.cc new file mode 100644 index 00000000000..a44cace607c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/constexpr_data.cc @@ -0,0 +1,52 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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 <type_traits> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v(_Ttesttype::value); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + test.operator()<std::integral_constant<unsigned short, 69>>(); + test.operator()<std::integral_constant<bool, true>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc index 4921716b75c..91f4aefde61 100644 --- a/libstdc++-v3/testsuite/util/testsuite_abi.cc +++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc @@ -193,6 +193,7 @@ check_version(symbol& test, bool added) known_versions.push_back("GLIBCXX_3.4.13"); known_versions.push_back("GLIBCXX_3.4.14"); known_versions.push_back("GLIBCXX_3.4.15"); + known_versions.push_back("GLIBCXX_3.4.16"); known_versions.push_back("GLIBCXX_LDBL_3.4"); known_versions.push_back("GLIBCXX_LDBL_3.4.7"); known_versions.push_back("GLIBCXX_LDBL_3.4.10"); diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h index 1db0ca08c79..4da2634367c 100644 --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h @@ -339,6 +339,14 @@ namespace __gnu_test typedef transform<integral_types::type, atomics>::type atomics_tl; #endif + template<typename Tp> + struct numeric_limits + { + typedef Tp value_type; + typedef std::numeric_limits<value_type> type; + }; + + typedef transform<integral_types::type, numeric_limits>::type limits_tl; struct has_increment_operators { @@ -384,6 +392,20 @@ namespace __gnu_test } }; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Tp> + void + constexpr_bitwise_operators() + { + constexpr _Tp a = _Tp(); + constexpr _Tp b = _Tp(); + constexpr _Tp c1 = a | b; + constexpr _Tp c2 = a & b; + constexpr _Tp c3 = a ^ b; + constexpr _Tp c4 = ~b; + } +#endif + template<typename _Tp> void bitwise_operators() @@ -588,6 +610,53 @@ namespace __gnu_test } }; + // Generator to test constexpr constructor +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + // Generator to test default constructor. + struct constexpr_default_constructible + { + template<typename _Tp> + void + operator()() + { + struct _Concept + { + // Have to have user-defined default ctor for this to work. + void __constraint() + { constexpr _Tp __v; } + }; + + void (_Concept::*__x)() __attribute__((unused)) + = &_Concept::__constraint; + } + }; + + struct constexpr_single_value_constructible + { + template<typename _Ttesttype, typename _Tbasetype> + void + operator()() + { + struct _Concept + { + // Additional constraint on _Tbasetype needed. + // Either assume user-defined default ctor as per + // constexpr_default_constructible and provide no + // initializer, provide an initializer, or assume empty-list + // init-able. Choose the latter. + void __constraint() + { + constexpr _Tbasetype __v { }; + constexpr _Ttesttype __t(__v); + } + }; + + _Concept c; + c.__constraint(); + } + }; +#endif + // Generator to test direct list initialization #ifdef __GXX_EXPERIMENTAL_CXX0X__ struct direct_list_initializable |