diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-24 18:57:01 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-24 18:57:01 +0000 |
commit | 32517648bf3e72828fd9729a932ba3ca27416a24 (patch) | |
tree | 1475cbb289d706d4eaa9f5b33bd688be99eb15cc /libstdc++-v3 | |
parent | f8b5a1eac94090808a801b229414d78311df5ad4 (diff) | |
download | gcc-32517648bf3e72828fd9729a932ba3ca27416a24.tar.gz |
2010-11-24 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 167123
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@167125 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
30 files changed, 931 insertions, 269 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 133e400e370..bf498c36ffc 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,67 @@ +2010-11-24 Benjamin Kosnik <bkoz@redhat.com> + + * include/std/tuple: Mark more constructors constexpr. + * include/bits/stl_pair.h: Same. + * testsuite/20_util/tuple/requirements/dr801.cc: New. + * testsuite/20_util/pair/requirements/dr801.cc: New. + * testsuite/20_util/tuple/cons/constexpr.cc: Add cases for new + constexpr constructors. + * testsuite/20_util/pair/cons/constexpr.cc: Same. + * testsuite/20_util/pair/comparison_operators/constexpr.cc: New. + + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust line number. + +2010-11-24 Paolo Carlini <paolo.carlini@oracle.com> + + * testsuite/30_threads/future/cons/constexpr.cc: Add dg-require* + directives. + * testsuite/30_threads/shared_future/cons/constexpr.cc: Likewise. + +2010-11-23 Benjamin Kosnik <bkoz@redhat.com> + + * include/std/chrono: Constexpr markup for is_monotonic. + * src/chrono.cc: Same. + * testsuite/20_util/clocks/1.cc: Move... + * testsuite/20_util/system_clock/1.cc: ...here. + * testsuite/20_util/system_clock/constexpr_data.cc + * testsuite/20_util/monotonic_clock/constexpr_data.cc + + * include/std/complex: Mark primary template constexpr. + * testsuite/26_numerics/complex/cons/constexpr_primary.cc: Add. + * testsuite/26_numerics/complex/complex_value.cc: Move... + * testsuite/26_numerics/complex/dr387.cc: Move... + * testsuite/26_numerics/complex/value_operations/1.cc: ... here. + * testsuite/26_numerics/complex/value_operations/dr387.cc: ...here. + * testsuite/26_numerics/complex/value_operations/constexpr.cc: New. + +2010-11-23 Benjamin Kosnik <bkoz@redhat.com> + Jason Merrill <jason@redhat.com> + + * testsuite/lib/libstdc++.exp: Use scanasm. + * testsuite/util/testsuite_common_types.h + (constexpr_default_constructible): Add support for non-literal types. + (constexpr_single_value_constructible): Same. + * testsuite/20_util/enable_shared_from_this/cons/constexpr.cc: + Remove xfail. + * testsuite/20_util/shared_ptr/cons/constexpr.cc: Add. + * testsuite/20_util/unique_ptr/cons/constexpr.cc: Add. + * testsuite/20_util/weak_ptr/cons/constexpr.cc: Add. + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust line number. + +2010-11-23 Benjamin Kosnik <bkoz@redhat.com> + Jonathan Wakely <jwakely.gcc@gmail.com> + + * include/std/future (shared_future): Default ctor constexpr. + (future): Same. + * testsuite/30_threads/shared_future/cons/constexpr.cc: New. + * testsuite/30_threads/future/cons/constexpr.cc: New. + +2010-11-23 Uros Bizjak <ubizjak@gmail.com> + + * testsuite/22_locale/collate/hash/char/wrapped_locale.cc: Require + additional locale name. + * testsuite/22_locale/collate/hash/char/wrapped_env.cc: Ditto. + 2010-11-18 Jonathan Wakely <jwakely.gcc@gmail.com> PR libstdc++/46455 @@ -94,42 +158,42 @@ PR libstdc++/44436 (partial) PR libstdc++/46148 - * include/bits/stl_tree.h (_Rb_tree<>::_M_insert_, _M_insert_lower, + * include/bits/stl_tree.h (_Rb_tree<>::_M_insert_, _M_insert_lower, _M_insert_equal_lower, _M_insert_unique, _M_insert_equal, _M_insert_unique_, _M_insert_equal_): Templatize in C++0x mode, use _GLIBCXX_FORWARD throughout. - * include/bits/stl_map.h (map<>::insert(_Pair&&), + * include/bits/stl_map.h (map<>::insert(_Pair&&), insert(const_iterator, _Pair&&), operator[](key_type&&): Add. - * include/bits/stl_set.h (set<>::insert(value_type&&), + * include/bits/stl_set.h (set<>::insert(value_type&&), insert(const_iterator, value_type&&)): Likewise. - * include/bits/stl_multimap.h (multimap<>::insert(_Pair&&), + * include/bits/stl_multimap.h (multimap<>::insert(_Pair&&), insert(const_iterator, _Pair&&)): Likewise. - * include/bits/stl_multiset.h (multiset<>::insert(value_type&&), + * include/bits/stl_multiset.h (multiset<>::insert(value_type&&), insert(const_iterator, value_type&&)): Likewise. * include/debug/set.h: Adjust. - * include/debug/multiset.h: Likewise. - * include/debug/map.h: Likewise. - * include/debug/multimap.h: Likewise. - * include/profile/set.h: Likewise. - * include/profile/multiset.h: Likewise. - * include/profile/map.h: Likewise. - * include/profile/multimap.h: Likewise. - * testsuite/23_containers/multimap/modifiers/insert/1.cc: New. - * testsuite/23_containers/multimap/modifiers/insert/2.cc: Likewise. - * testsuite/23_containers/multimap/modifiers/insert/3.cc: Likewise. - * testsuite/23_containers/multimap/modifiers/insert/4.cc: Likewise. - * testsuite/23_containers/set/modifiers/insert/2.cc: Likewise. - * testsuite/23_containers/set/modifiers/insert/3.cc: Likewise. - * testsuite/23_containers/multiset/modifiers/insert/3.cc: Likewise. - * testsuite/23_containers/multiset/modifiers/insert/4.cc: Likewise. - * testsuite/23_containers/map/modifiers/insert/2.cc: Likewise. - * testsuite/23_containers/map/modifiers/insert/3.cc: Likewise. - * testsuite/23_containers/map/modifiers/insert/4.cc: Likewise. - * testsuite/23_containers/map/modifiers/insert/5.cc: Likewise. - * testsuite/23_containers/map/element_access/2.cc: Likewise. - * testsuite/23_containers/map/element_access/46148.cc: Likewise. - - * include/bits/hashtable.h: Trivial naming changes. + * include/debug/multiset.h: Likewise. + * include/debug/map.h: Likewise. + * include/debug/multimap.h: Likewise. + * include/profile/set.h: Likewise. + * include/profile/multiset.h: Likewise. + * include/profile/map.h: Likewise. + * include/profile/multimap.h: Likewise. + * testsuite/23_containers/multimap/modifiers/insert/1.cc: New. + * testsuite/23_containers/multimap/modifiers/insert/2.cc: Likewise. + * testsuite/23_containers/multimap/modifiers/insert/3.cc: Likewise. + * testsuite/23_containers/multimap/modifiers/insert/4.cc: Likewise. + * testsuite/23_containers/set/modifiers/insert/2.cc: Likewise. + * testsuite/23_containers/set/modifiers/insert/3.cc: Likewise. + * testsuite/23_containers/multiset/modifiers/insert/3.cc: Likewise. + * testsuite/23_containers/multiset/modifiers/insert/4.cc: Likewise. + * testsuite/23_containers/map/modifiers/insert/2.cc: Likewise. + * testsuite/23_containers/map/modifiers/insert/3.cc: Likewise. + * testsuite/23_containers/map/modifiers/insert/4.cc: Likewise. + * testsuite/23_containers/map/modifiers/insert/5.cc: Likewise. + * testsuite/23_containers/map/element_access/2.cc: Likewise. + * testsuite/23_containers/map/element_access/46148.cc: Likewise. + + * include/bits/hashtable.h: Trivial naming changes. 2010-11-10 Paolo Carlini <paolo.carlini@oracle.com> @@ -145,10 +209,10 @@ line number. 2010-11-09 François Dumont <francois.cppdevs@free.fr> - Johannes Singler <singler@kit.edu> + Johannes Singler <singler@kit.edu> - * include/parallel/algobase.h (equal): Call parallel variant - for applicable overloads. + * include/parallel/algobase.h (equal): Call parallel variant + for applicable overloads. 2010-11-09 Paolo Carlini <paolo.carlini@oracle.com> @@ -180,8 +244,8 @@ 2010-11-08 Benjamin Kosnik <bkoz@redhat.com> - * include/std/complex (operator==, !=): Mark constexpr. - * testsuite/26_numerics/complex/comparison_operators/constexpr.cc: New. + * include/std/complex (operator==, !=): Mark constexpr. + * testsuite/26_numerics/complex/comparison_operators/constexpr.cc: New. 2010-11-08 Paolo Carlini <paolo.carlini@oracle.com> @@ -1839,89 +1903,89 @@ 2010-08-29 François Dumont <francois.cppdevs@free.fr> - * include/bits/stl_algobase.h (_Iter_base): Move... - * include/bits/stl_iterator_base_types.h: ...here. - * include/debug/functions.h (__check_valid_range, __check_string, + * include/bits/stl_algobase.h (_Iter_base): Move... + * include/bits/stl_iterator_base_types.h: ...here. + * include/debug/functions.h (__check_valid_range, __check_string, __check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include formatter.h and use formatting macros for a consistent debug result. - * include/debug/formatter.h (__check_singular): Declare; do not + * include/debug/formatter.h (__check_singular): Declare; do not include debug.h. - * include/debug/debug.h: Do not include formatter.h. - * include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator) - rename to iterator_type. + * include/debug/debug.h: Do not include formatter.h. + * include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator) + rename to iterator_type. (__gnu_debug::__base): Add. - * include/debug/set.h: Use everywhere __gnu_debug::__base once + * include/debug/set.h: Use everywhere __gnu_debug::__base once iterator range valided. - * include/debug/unordered_map: Likewise. - * include/debug/multiset.h: Likewise. - * include/debug/vector: Likewise. - * include/debug/unordered_set: Likewise. - * include/debug/deque: Likewise. - * include/debug/map.h: Likewise. - * include/debug/string: Likewise. - * include/debug/list: Likewise. - * include/debug/multimap.h: Likewise. - * testsuite/23_containers/util/debug/assign_neg.h: New test cases on - debug checks performed on container assign operation. - * testsuite/23_containers/util/debug/construct_neg.h: New test cases - on debug checks on constructors. - * testsuite/23_containers/util/debug/insert_neg.h: New test cases on - debug checks performed on container insert operations. - * testsuite/23_containers/unordered_map/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: New. - * testsuite/23_containers/multimap/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/set/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/unordered_multimap/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/unordered_set/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/multiset/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/unordered_multiset/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/map/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/vector/debug/cont_traits.h, - debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, - assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/deque/debug/cont_traits.h, - debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, - assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. + * include/debug/unordered_map: Likewise. + * include/debug/multiset.h: Likewise. + * include/debug/vector: Likewise. + * include/debug/unordered_set: Likewise. + * include/debug/deque: Likewise. + * include/debug/map.h: Likewise. + * include/debug/string: Likewise. + * include/debug/list: Likewise. + * include/debug/multimap.h: Likewise. + * testsuite/23_containers/util/debug/assign_neg.h: New test cases on + debug checks performed on container assign operation. + * testsuite/23_containers/util/debug/construct_neg.h: New test cases + on debug checks on constructors. + * testsuite/23_containers/util/debug/insert_neg.h: New test cases on + debug checks performed on container insert operations. + * testsuite/23_containers/unordered_map/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: New. + * testsuite/23_containers/multimap/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/set/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/unordered_multimap/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/unordered_set/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/multiset/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/unordered_multiset/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/map/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/vector/debug/cont_traits.h, + debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, + assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/deque/debug/cont_traits.h, + debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, + assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. * testsuite/23_containers/list/debug/cont_traits.h, - debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, - assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/performance/23_containers/range_construct/ + debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, + assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/performance/23_containers/range_construct/ list_construct1.cc: New, validate performance impact of the patch on the debug mode. - * testsuite/performance/23_containers/range_construct/ + * testsuite/performance/23_containers/range_construct/ list_construct2.cc: Likewise. - * testsuite/performance/23_containers/range_construct/ + * testsuite/performance/23_containers/range_construct/ vector_construct.cc: Likewise. - * testsuite/performance/23_containers/range_construct/ + * testsuite/performance/23_containers/range_construct/ deque_construct.cc: Likewise. 2010-08-26 Benjamin Kosnik <bkoz@redhat.com> @@ -3217,18 +3281,18 @@ 2010-06-08 Johannes Singler <singler@kit.edu> - * include/parallel/find.h - (__find_template(.., growing_blocks_tag)): Make block size - proportional to current position. - * include/parallel/settings.h (_Settings): Introduce new tuning - parameter find_scale_factor to the end of the struct, defaults to - 0.01f. + * include/parallel/find.h + (__find_template(.., growing_blocks_tag)): Make block size + proportional to current position. + * include/parallel/settings.h (_Settings): Introduce new tuning + parameter find_scale_factor to the end of the struct, defaults to + 0.01f. 2010-06-08 Johannes Singler <singler@kit.edu> - * include/parallel/partial_sum.h - (__parallel_partial_sum_linear): - Correctly calculate part lengths for partial_sum_dilation!=1. + * include/parallel/partial_sum.h + (__parallel_partial_sum_linear): + Correctly calculate part lengths for partial_sum_dilation!=1. 2010-06-07 Paolo Carlini <paolo.carlini@oracle.com> @@ -3458,7 +3522,7 @@ * doc/xml/manual/status_cxx200x.xml: Update. 2010-06-05 Magnus Fromreide <magfr@lysator.liu.se> - Jonathan Wakely <jwakely.gcc@gmail.com> + Jonathan Wakely <jwakely.gcc@gmail.com> * include/std/functional (function): Add nullptr_t support. * include/bits/shared_ptr.h (shared_ptr): Likewise. @@ -3509,7 +3573,7 @@ 2010-06-03 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/c++config (std::size_t, std::ptrdiff_t, - std::nullptr_t): Provide typedefs. + std::nullptr_t): Provide typedefs. * include/c_std/cstddef: Don't provide std::size_t and std::ptrdiff_t here. * include/c_global/cstddef: Likewise. @@ -4289,11 +4353,11 @@ 2010-04-22 Johannes Singler <singler@kit.edu> - * include/parallel/partition.h (__parallel_partition): - Improve scalability by: - -introducing new variables __leftold, __rightold, __dist, thus - -getting rid of omp lock by using atomic operations - -getting rid of two omp barriers + * include/parallel/partition.h (__parallel_partition): + Improve scalability by: + -introducing new variables __leftold, __rightold, __dist, thus + -getting rid of omp lock by using atomic operations + -getting rid of two omp barriers 2010-04-22 Jonathan Wakely <jwakely.gcc@gmail.com> @@ -4343,10 +4407,10 @@ 2010-03-30 Johannes Singler <singler@kit.edu> - * include/parallel/random_shuffle.h - (__parallel_random_shuffle_drs) : Take as many threads as - possible, i. e. favor parallelism over cache efficiency. - Use own PRNG also for the 1 thread case. + * include/parallel/random_shuffle.h + (__parallel_random_shuffle_drs) : Take as many threads as + possible, i. e. favor parallelism over cache efficiency. + Use own PRNG also for the 1 thread case. 2010-03-30 Paolo Carlini <paolo.carlini@oracle.com> @@ -4413,14 +4477,14 @@ 2010-03-22 Johannes Singler <singler@kit.edu> - * include/parallel/numeric (inner_product, partial_sum): - Precede subsequent call with _GLIBCXX_STD_P:: to avoid ambiguity - between __gnu_parallel:: and std:: - * include/parallel/algobase.h (equal): Likewise. - * include/parallel/algo.h (find_first_of, search_n, merge, nth_element, - partial_sort, max_element, min_element): Likewise. - * include/parallel/partial_sum.h (__parallel_partial_sum_linear): - Qualify accumulate call with __gnu_parallel::. + * include/parallel/numeric (inner_product, partial_sum): + Precede subsequent call with _GLIBCXX_STD_P:: to avoid ambiguity + between __gnu_parallel:: and std:: + * include/parallel/algobase.h (equal): Likewise. + * include/parallel/algo.h (find_first_of, search_n, merge, nth_element, + partial_sort, max_element, min_element): Likewise. + * include/parallel/partial_sum.h (__parallel_partial_sum_linear): + Qualify accumulate call with __gnu_parallel::. 2010-03-22 Paolo Carlini <paolo.carlini@oracle.com> @@ -4940,8 +5004,8 @@ 2010-02-28 Paolo Carlini <paolo.carlini@oracle.com> - * src/hash-long-double-aux.cc (hash<long double>:: - operator()(long double)): Hash both -0 and +0 to 0. + * src/hash-long-double-aux.cc (hash<long double>:: + operator()(long double)): Hash both -0 and +0 to 0. 2010-02-25 Ed Smith-Rowland <3dw4rd@verizon.net> @@ -5088,9 +5152,9 @@ 2010-02-22 François Dumont <francois.cppdevs@free.fr> - * doc/xml/manual/profile_mode.xml: Minor updates and fixes. - * doc/xml/manual/debug_mode.xml: Likewise. - * doc/xml/manual/test.xml: Likewise. + * doc/xml/manual/profile_mode.xml: Minor updates and fixes. + * doc/xml/manual/debug_mode.xml: Likewise. + * doc/xml/manual/test.xml: Likewise. 2010-02-22 Paolo Carlini <paolo.carlini@oracle.com> diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 0e651e7ba76..c6753f6d5d9 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -98,63 +98,67 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : first(), second() { } /** Two objects may be passed to a @c pair constructor to be copied. */ - pair(const _T1& __a, const _T2& __b) + _GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } + /** There is also a templated copy ctor for the @c pair class itself. */ + template<class _U1, class _U2> + _GLIBCXX_CONSTEXPR pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } + #ifdef __GXX_EXPERIMENTAL_CXX0X__ - pair(const pair&) = default; + constexpr pair(const pair&) = default; + + // Implicit. + // pair(pair&&) = default; // DR 811. template<class _U1, class = typename std::enable_if<std::is_convertible<_U1, _T1>::value>::type> - pair(_U1&& __x, const _T2& __y) - : first(std::forward<_U1>(__x)), - second(__y) { } + pair(_U1&& __x, const _T2& __y) + : first(std::forward<_U1>(__x)), second(__y) { } template<class _U2, class = typename std::enable_if<std::is_convertible<_U2, _T2>::value>::type> - pair(const _T1& __x, _U2&& __y) - : first(__x), - second(std::forward<_U2>(__y)) { } + pair(const _T1& __x, _U2&& __y) + : first(__x), second(std::forward<_U2>(__y)) { } template<class _U1, class _U2, class = typename std::enable_if<std::is_convertible<_U1, _T1>::value && std::is_convertible<_U2, _T2>::value>::type> - pair(_U1&& __x, _U2&& __y) - : first(std::forward<_U1>(__x)), - second(std::forward<_U2>(__y)) { } + pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } - template<class... _Args1, class... _Args2> - pair(piecewise_construct_t, - tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args) - : first(__cons<first_type>(std::move(__first_args))), - second(__cons<second_type>(std::move(__second_args))) { } -#endif - - /** There is also a templated copy ctor for the @c pair class itself. */ template<class _U1, class _U2> - pair(const pair<_U1, _U2>& __p) - : first(__p.first), - second(__p.second) { } - -#ifdef __GXX_EXPERIMENTAL_CXX0X__ - template<class _U1, class _U2> - pair(pair<_U1, _U2>&& __p) + pair(pair<_U1, _U2>&& __p) : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) { } + template<class... _Args1, class... _Args2> + pair(piecewise_construct_t, + tuple<_Args1...> __first, tuple<_Args2...> __second) + : first(__cons<first_type>(std::move(__first))), + second(__cons<second_type>(std::move(__second))) { } + + pair& + operator=(const pair& __p) + { + first = __p.first; + second = __p.second; + return *this; + } + pair& operator=(pair&& __p) - { + { first = std::move(__p.first); second = std::move(__p.second); return *this; } template<class _U1, class _U2> - pair& - operator=(const pair<_U1, _U2>& __p) + pair& + operator=(const pair<_U1, _U2>& __p) { first = __p.first; second = __p.second; @@ -162,8 +166,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template<class _U1, class _U2> - pair& - operator=(pair<_U1, _U2>&& __p) + pair& + operator=(pair<_U1, _U2>&& __p) { first = std::move(__p.first); second = std::move(__p.second); @@ -175,54 +179,54 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { using std::swap; swap(first, __p.first); - swap(second, __p.second); + swap(second, __p.second); } private: template<typename _Tp, typename... _Args> - static _Tp - __cons(tuple<_Args...>&&); + static _Tp + __cons(tuple<_Args...>&&); template<typename _Tp, typename... _Args, int... _Indexes> - static _Tp - __do_cons(tuple<_Args...>&&, const _Index_tuple<_Indexes...>&); + static _Tp + __do_cons(tuple<_Args...>&&, const _Index_tuple<_Indexes...>&); #endif }; /// Two pairs of the same type are equal iff their members are equal. template<class _T1, class _T2> - inline bool + inline _GLIBCXX_CONSTEXPR bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first == __y.first && __x.second == __y.second; } /// <http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html> template<class _T1, class _T2> - inline bool + inline _GLIBCXX_CONSTEXPR bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); } /// Uses @c operator== to find the result. template<class _T1, class _T2> - inline bool + inline _GLIBCXX_CONSTEXPR bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__x == __y); } /// Uses @c operator< to find the result. template<class _T1, class _T2> - inline bool + inline _GLIBCXX_CONSTEXPR bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __y < __x; } /// Uses @c operator< to find the result. template<class _T1, class _T2> - inline bool + inline _GLIBCXX_CONSTEXPR bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__y < __x); } /// Uses @c operator< to find the result. template<class _T1, class _T2> - inline bool + inline _GLIBCXX_CONSTEXPR bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__x < __y); } @@ -248,22 +252,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) */ // _GLIBCXX_RESOLVE_LIB_DEFECTS // 181. make_pair() unintended behavior -#ifndef __GXX_EXPERIMENTAL_CXX0X__ - template<class _T1, class _T2> - inline pair<_T1, _T2> - make_pair(_T1 __x, _T2 __y) - { return pair<_T1, _T2>(__x, __y); } -#else +#ifdef __GXX_EXPERIMENTAL_CXX0X__ // NB: DR 706. template<class _T1, class _T2> inline pair<typename __decay_and_strip<_T1>::__type, typename __decay_and_strip<_T2>::__type> make_pair(_T1&& __x, _T2&& __y) { - return pair<typename __decay_and_strip<_T1>::__type, - typename __decay_and_strip<_T2>::__type> - (std::forward<_T1>(__x), std::forward<_T2>(__y)); + typedef typename __decay_and_strip<_T1>::__type __ds_type1; + typedef typename __decay_and_strip<_T2>::__type __ds_type2; + typedef pair<__ds_type1, __ds_type2> __pair_type; + return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y)); } +#else + template<class _T1, class _T2> + inline pair<_T1, _T2> + make_pair(_T1 __x, _T2 __y) + { return pair<_T1, _T2>(__x, __y); } #endif _GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index c4dcbd5f67f..25110817a15 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -228,7 +228,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) && (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value)>::type> constexpr explicit duration(const _Rep2& __rep) - : __r(static_cast<rep>(__rep)) { } + : __r(static_cast<rep>(__rep)) { } template<typename _Rep2, typename _Period2, typename = typename enable_if<treat_as_floating_point<rep>::value @@ -644,22 +644,22 @@ _GLIBCXX_BEGIN_NAMESPACE(std) struct system_clock { #ifdef _GLIBCXX_USE_CLOCK_REALTIME - typedef chrono::nanoseconds duration; + typedef chrono::nanoseconds duration; #elif defined(_GLIBCXX_USE_GETTIMEOFDAY) - typedef chrono::microseconds duration; + typedef chrono::microseconds duration; #else - typedef chrono::seconds duration; + typedef chrono::seconds duration; #endif - typedef duration::rep rep; - typedef duration::period period; - typedef chrono::time_point<system_clock, duration> time_point; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point<system_clock, duration> time_point; static_assert(system_clock::duration::min() < system_clock::duration::zero(), "a clock's minimum duration cannot be less than its epoch"); - static const bool is_monotonic = false; + static constexpr bool is_monotonic = false; static time_point now() throw (); @@ -685,12 +685,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// monotonic_clock struct monotonic_clock { - typedef chrono::nanoseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef chrono::time_point<monotonic_clock, duration> time_point; + typedef chrono::nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point<monotonic_clock, duration> time_point; - static const bool is_monotonic = true; + static constexpr bool is_monotonic = true; static time_point now(); diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index ffdadc3757e..4bd8e8c42e1 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -529,12 +529,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Values #ifdef __GXX_EXPERIMENTAL_CXX0X__ template<typename _Tp> - inline _Tp + inline constexpr _Tp real(const complex<_Tp>& __z) { return __z.real(); } template<typename _Tp> - inline _Tp + inline constexpr _Tp imag(const complex<_Tp>& __z) { return __z.imag(); } #else diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 0c367955914..45691168f3f 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -556,7 +556,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) explicit __basic_future(future<_Res>&&); - __basic_future() { } + constexpr __basic_future() : _M_state() { } struct _Reset { @@ -584,7 +584,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) future(const __state_type& __state) : _Base_type(__state) { } public: - future() : _Base_type() { } + constexpr future() : _Base_type() { } /// Move constructor future(future&& __uf) : _Base_type(std::move(__uf)) { } @@ -625,7 +625,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) future(const __state_type& __state) : _Base_type(__state) { } public: - future() : _Base_type() { } + constexpr future() : _Base_type() { } /// Move constructor future(future&& __uf) : _Base_type(std::move(__uf)) { } @@ -666,7 +666,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) future(const __state_type& __state) : _Base_type(__state) { } public: - future() : _Base_type() { } + constexpr future() : _Base_type() { } /// Move constructor future(future&& __uf) : _Base_type(std::move(__uf)) { } @@ -698,7 +698,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef __basic_future<_Res> _Base_type; public: - shared_future() : _Base_type() { } + constexpr shared_future() : _Base_type() { } /// Copy constructor shared_future(const shared_future& __sf) : _Base_type(__sf) { } @@ -742,7 +742,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef __basic_future<_Res&> _Base_type; public: - shared_future() : _Base_type() { } + constexpr shared_future() : _Base_type() { } /// Copy constructor shared_future(const shared_future& __sf) : _Base_type(__sf) { } @@ -781,7 +781,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef __basic_future<void> _Base_type; public: - shared_future() : _Base_type() { } + constexpr shared_future() : _Base_type() { } /// Copy constructor shared_future(const shared_future& __sf) : _Base_type(__sf) { } diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 682712104a2..df9ef1d1694 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -67,7 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) constexpr _Head_base() : _Head() { } - _Head_base(const _Head& __h) + constexpr _Head_base(const _Head& __h) : _Head(__h) { } template<typename _UHead> @@ -77,7 +77,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Head& _M_head() { return *this; } const _Head& _M_head() const { return *this; } - void _M_swap_impl(_Head&) { /* no-op */ } + void + _M_swap_impl(_Head&) { /* no-op */ } }; template<std::size_t _Idx, typename _Head> @@ -86,7 +87,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) constexpr _Head_base() : _M_head_impl() { } - _Head_base(const _Head& __h) + constexpr _Head_base(const _Head& __h) : _M_head_impl(__h) { } template<typename _UHead> @@ -151,7 +152,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : _Inherited(), _Base() { } explicit - _Tuple_impl(const _Head& __head, const _Tail&... __tail) + constexpr _Tuple_impl(const _Head& __head, const _Tail&... __tail) : _Inherited(__tail...), _Base(__head) { } template<typename _UHead, typename... _UTail> @@ -160,10 +161,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : _Inherited(std::forward<_UTail>(__tail)...), _Base(std::forward<_UHead>(__head)) { } - _Tuple_impl(const _Tuple_impl&) = default; + constexpr _Tuple_impl(const _Tuple_impl&) = default; _Tuple_impl(_Tuple_impl&& __in) - : _Inherited(std::move(__in._M_tail())), + : _Inherited(std::move(__in._M_tail())), _Base(std::forward<_Head>(__in._M_head())) { } template<typename... _UElements> @@ -229,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : _Inherited() { } explicit - tuple(const _Elements&... __elements) + constexpr tuple(const _Elements&... __elements) : _Inherited(__elements...) { } template<typename... _UElements, typename = typename @@ -239,7 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) tuple(_UElements&&... __elements) : _Inherited(std::forward<_UElements>(__elements)...) { } - tuple(const tuple&) = default; + constexpr tuple(const tuple&) = default; tuple(tuple&& __in) : _Inherited(static_cast<_Inherited&&>(__in)) { } @@ -314,7 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : _Inherited() { } explicit - tuple(const _T1& __a1, const _T2& __a2) + constexpr tuple(const _T1& __a1, const _T2& __a2) : _Inherited(__a1, __a2) { } template<typename _U1, typename _U2> @@ -322,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) tuple(_U1&& __a1, _U2&& __a2) : _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { } - tuple(const tuple&) = default; + constexpr tuple(const tuple&) = default; tuple(tuple&& __in) : _Inherited(static_cast<_Inherited&&>(__in)) { } @@ -412,7 +413,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : _Inherited() { } explicit - tuple(const _T1& __a1) + constexpr tuple(const _T1& __a1) : _Inherited(__a1) { } template<typename _U1, typename = typename @@ -421,14 +422,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) tuple(_U1&& __a1) : _Inherited(std::forward<_U1>(__a1)) { } - tuple(const tuple&) = default; + constexpr tuple(const tuple&) = default; tuple(tuple&& __in) : _Inherited(static_cast<_Inherited&&>(__in)) { } template<typename _U1> tuple(const tuple<_U1>& __in) - : _Inherited(static_cast<const _Tuple_impl<0, _U1>&>(__in)) { } + : _Inherited(static_cast<const _Tuple_impl<0, _U1>&>(__in)) { } template<typename _U1> tuple(tuple<_U1>&& __in) diff --git a/libstdc++-v3/src/chrono.cc b/libstdc++-v3/src/chrono.cc index 699a10a7253..4dcd74bcee3 100644 --- a/libstdc++-v3/src/chrono.cc +++ b/libstdc++-v3/src/chrono.cc @@ -37,7 +37,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) namespace chrono { - const bool system_clock::is_monotonic; + constexpr bool system_clock::is_monotonic; system_clock::time_point system_clock::now() throw () @@ -61,7 +61,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } #ifdef _GLIBCXX_USE_CLOCK_MONOTONIC - const bool monotonic_clock::is_monotonic; + constexpr bool monotonic_clock::is_monotonic; monotonic_clock::time_point monotonic_clock::now() diff --git a/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc index 0df6dcf3896..f66944b3a90 100644 --- a/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/cons/constexpr.cc @@ -1,5 +1,7 @@ -// { dg-do compile { xfail *-*-* } } -// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// { dg-options "-std=gnu++0x -fno-inline -save-temps" } +// { dg-final { scan-assembler-not "_ZNSt23enable_shared_from_thisIiEC2Ev" } } +// { dg-final { scan-assembler-not "_ZN7derivedC2Ev" } } // Copyright (C) 2010 Free Software Foundation, Inc. // @@ -29,7 +31,6 @@ struct derived : public std::enable_shared_from_this<int> int main() { __gnu_test::constexpr_default_constructible test; - test.operator()<derived>(); // { dg-excess-errors "" } - derived d; + test.operator()<derived>(); return 0; } diff --git a/libstdc++-v3/testsuite/20_util/monotonic_clock/constexpr_data.cc b/libstdc++-v3/testsuite/20_util/monotonic_clock/constexpr_data.cc new file mode 100644 index 00000000000..34477ea1838 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/monotonic_clock/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 <chrono> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::is_monotonic; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + test.operator()<std::chrono::monotonic_clock>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/pair/comparison_operators/constexpr.cc b/libstdc++-v3/testsuite/20_util/pair/comparison_operators/constexpr.cc new file mode 100644 index 00000000000..d5dc6e4e1df --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/comparison_operators/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 <utility> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_comparison_operators test; + test.operator()<std::pair<int, int>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc index 7bf6b71162d..1c854627ed4 100644 --- a/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/pair/cons/constexpr.cc @@ -23,7 +23,17 @@ int main() { - __gnu_test::constexpr_default_constructible test; - test.operator()<std::pair<int, int>>(); + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::pair<int, int>>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::pair<int, int>, std::pair<int, int>>(); + test2.operator()<std::pair<int, int>, std::pair<short, short>>(); + + // test 3 + const int i1(129); + const int i2(6); + constexpr std::pair<int, int> p3(i1, i2); + return 0; } diff --git a/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc new file mode 100644 index 00000000000..36d380dcf87 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.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 <memory> +#include <type_traits> + +// DR 801, pair and tuple vs. "passed in registers" +void test_trivial() +{ + // PODType, TType, NType, SLType, LType, NLType, LTypeDerived + typedef std::pair<int, int> pair_type; + // static_assert(std::is_literal_type<pair_type>::value, "! literal"); + static_assert(std::has_trivial_copy_constructor<pair_type>::value, + "! triv copy"); + static_assert(std::has_trivial_destructor<pair_type>::value, + "! triv destructor"); + // static_assert(std::is_standard_layout<pair_type>::value, + // "! standard layout"); + + // Negative + /* + static_assert(std::has_trivial_default_constructor<pair_type>::value, + "! triv default"); + static_assert(std::has_trivial_copy_assign<pair_type>::value, + "! triv assign"); + static_assert(std::is_trivial<pair_type>::value, "! triv"); + static_assert(std::is_pod<pair_type>::value, "! pod"); + */ +} + +int main() +{ + test_trivial(); + 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..72eea9e0ffc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/constexpr.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x -fno-inline -save-temps" } +// { dg-final { scan-assembler-not "_ZNSt10shared_ptrIiEC2Ev" } } +// { dg-final { scan-assembler-not "_ZNSt10shared_ptrIiEC2EDn" } } + +// 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; //not literal + test1.operator()<std::shared_ptr<int>>(); + + __gnu_test::constexpr_single_value_constructible test2; //not literal + test2.operator()<std::shared_ptr<int>, std::nullptr_t>(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/clocks/1.cc b/libstdc++-v3/testsuite/20_util/system_clock/1.cc index aac12be6b2f..ead20873c7b 100644 --- a/libstdc++-v3/testsuite/20_util/clocks/1.cc +++ b/libstdc++-v3/testsuite/20_util/system_clock/1.cc @@ -6,7 +6,7 @@ // 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 2, or (at your option) +// 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, @@ -15,9 +15,8 @@ // 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 COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. // 20.8.5 Clocks [time.clock] diff --git a/libstdc++-v3/testsuite/20_util/system_clock/constexpr_data.cc b/libstdc++-v3/testsuite/20_util/system_clock/constexpr_data.cc new file mode 100644 index 00000000000..2407ef16a71 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/system_clock/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 <chrono> +#include <testsuite_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::is_monotonic; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + test.operator()<std::chrono::system_clock>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc index a4666e5d5cd..b5eba73fdac 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr.cc @@ -23,7 +23,25 @@ int main() { - __gnu_test::constexpr_default_constructible test; - test.operator()<std::tuple<int, int>>(); + __gnu_test::constexpr_default_constructible test1; + test1.operator()<std::tuple<int, int>>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::tuple<int, int>, std::tuple<int, int>>(); + // test2.operator()<std::tuple<int, int>, std::pair<short, short>>(); + // test2.operator()<std::tuple<int>, std::tuple<short>>(); + // test2.operator()<std::tuple<int, int>, std::tuple<short, short>>(); + + // test 3 + const int i1(129); + const int i2(6); + constexpr std::tuple<int, int> p3(i1, i2); + + // test 4 + const int i3(415); + const int i4(550); + const int i5(6414); + constexpr std::tuple<int, int, int, int, int> p4(i1, i2, i3, i4, i5); + return 0; } diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc new file mode 100644 index 00000000000..fd21b9ee5c5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.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 <tuple> +#include <type_traits> + +// DR 801, pair and tuple vs. "passed in registers" +void test_trivial() +{ + // PODType, TType, NType, SLType, LType, NLType, LTypeDerived + typedef std::tuple<int, int> tuple_type; + // static_assert(std::is_literal_type<tuple_type>::value, "! literal"); + static_assert(std::has_trivial_copy_constructor<tuple_type>::value, + "! triv copy"); + static_assert(std::has_trivial_destructor<tuple_type>::value, + "! triv destructor"); + // static_assert(std::is_standard_layout<tuple_type>::value, + // "! standard layout"); + + // Negative + /* + static_assert(std::has_trivial_default_constructor<tuple_type>::value, + "! triv default"); + static_assert(std::has_trivial_copy_assign<tuple_type>::value, + "! triv assign"); + static_assert(std::is_trivial<tuple_type>::value, "! triv"); + static_assert(std::is_pod<tuple_type>::value, "! pod"); + */ +} + +int main() +{ + test_trivial(); + 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..1f3cabc789a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/constexpr.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x -fno-inline -save-temps" } +// { dg-final { scan-assembler-not "_ZNSt10unique_ptrIiSt14default_deleteIiEEC2Ev" } } +// { dg-final { scan-assembler-not "_ZNSt10unique_ptrIiSt14default_deleteIiEEC2EDn" } } + +// 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; //not literal + test1.operator()<std::unique_ptr<int>>(); + + __gnu_test::constexpr_single_value_constructible test2; //not literal + test2.operator()<std::unique_ptr<int>, std::nullptr_t>(); + + 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 f0a1f6cb1d4..7f5b109b61e 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 @@ -44,8 +44,8 @@ main() // { dg-warning "note" "" { target *-*-* } 350 } // { dg-warning "note" "" { target *-*-* } 1082 } // { dg-warning "note" "" { target *-*-* } 465 } -// { dg-warning "note" "" { target *-*-* } 580 } +// { dg-warning "note" "" { target *-*-* } 581 } // { dg-warning "note" "" { target *-*-* } 1027 } // { dg-warning "note" "" { target *-*-* } 340 } // { dg-warning "note" "" { target *-*-* } 290 } -// { dg-warning "note" "" { target *-*-* } 201 } +// { dg-warning "note" "" { target *-*-* } 205 } 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..ce19df1578d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/constexpr.cc @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x -fno-inline -save-temps" } +// { dg-final { scan-assembler-not "_ZNSt8weak_ptrIiEC2Ev" } } + +// 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; //not literal + test.operator()<std::weak_ptr<int>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc index b9961e49346..7aa6cf68959 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_env.cc @@ -1,3 +1,5 @@ +// { dg-require-namedlocale "en_US" } +// { dg-require-namedlocale "fr_FR" } // { dg-require-namedlocale "de_DE" } // 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> diff --git a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc index 3ae613f84dc..8fba98f54ae 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/hash/char/wrapped_locale.cc @@ -1,3 +1,6 @@ +// { dg-require-namedlocale "en_US" } +// { dg-require-namedlocale "fr_FR" } +// { dg-require-namedlocale "de_DE" } // { dg-require-namedlocale "ja_JP.eucjp" } // 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> diff --git a/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc new file mode 100644 index 00000000000..77e01bcff00 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.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 <complex> + +// User defined type, so that the primary std::complex template is used. +namespace numext +{ + struct ldld_base + { + long double one; + long double two; + }; + + struct ldld_lit : public ldld_base + { }; + + struct ldld_nonlit : public ldld_base + { + ~ldld_nonlit() { } + }; + + bool + operator<(const ldld_base __a, const ldld_base __b) + { return __a.one < __b.one && __a.two < __b.two; } + + bool + operator==(const ldld_base __a, const ldld_base __b) + { return __a.one == __b.one && __a.two == __b.two; } + + ldld_base + operator+=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one + __b.one, __a.two + __b.two}); } + + ldld_base + operator-=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one - __b.one, __a.two - __b.two}); } + + ldld_base + operator*=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one * __b.one, __a.two * __b.two}); } + + ldld_base + operator/=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one / __b.one, __a.two / __b.two}); } + +} + +constexpr std::complex<numext::ldld_lit> lit; // ok +// constexpr std::complex<numext::ldld_nonlit> nonlit; // error diff --git a/libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/1.cc index dc05a2b19b4..dc05a2b19b4 100644 --- a/libstdc++-v3/testsuite/26_numerics/complex/complex_value.cc +++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/1.cc diff --git a/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.cc new file mode 100644 index 00000000000..29728a2b3e0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.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_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 __attribute__((unused)) = real(a); + constexpr auto v2 __attribute__((unused)) = imag(a); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_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/complex/dr387.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/dr387.cc index 084a52c31dd..084a52c31dd 100644 --- a/libstdc++-v3/testsuite/26_numerics/complex/dr387.cc +++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/dr387.cc diff --git a/libstdc++-v3/testsuite/30_threads/future/cons/constexpr.cc b/libstdc++-v3/testsuite/30_threads/future/cons/constexpr.cc new file mode 100644 index 00000000000..a56d5852424 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/future/cons/constexpr.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x -fno-inline -save-temps" } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } +// { dg-require-atomic-builtins "" } +// { dg-final { scan-assembler-not "_ZNSt6futureIvEC2Ev" } } +// { dg-final { scan-assembler-not "_ZNSt6futureIiEC2Ev" } } + +// 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 <future> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; //not literal + test.operator()<std::future<int>>(); + test.operator()<std::future<void>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/cons/constexpr.cc b/libstdc++-v3/testsuite/30_threads/shared_future/cons/constexpr.cc new file mode 100644 index 00000000000..159077bc820 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/shared_future/cons/constexpr.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x -fno-inline -save-temps" } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } +// { dg-require-atomic-builtins "" } +// { dg-final { scan-assembler-not "_ZNSt13shared_futureIvEC2Ev" } } +// { dg-final { scan-assembler-not "_ZNSt13shared_futureIiEC2Ev" } } + +// 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 <future> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_default_constructible test; //not literal + test.operator()<std::shared_future<int>>(); + test.operator()<std::shared_future<void>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index dd717d97396..36b6e864f10 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -51,6 +51,7 @@ load_gcc_lib target-supports.exp load_gcc_lib target-supports-dg.exp load_lib prune.exp load_lib dg-options.exp +load_gcc_lib scanasm.exp load_gcc_lib target-libpath.exp load_gcc_lib timeout.exp load_gcc_lib timeout-dg.exp diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h index c78f9450417..0960b7916c4 100644 --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h @@ -637,50 +637,77 @@ namespace __gnu_test } }; - // Generator to test constexpr constructor #ifdef __GXX_EXPERIMENTAL_CXX0X__ // Generator to test default constructor. struct constexpr_default_constructible { + template<typename _Tp, bool _IsLitp = std::is_literal_type<_Tp>::value> + struct _Concept; + // NB: _Tp must be a literal type. + // Have to have user-defined default ctor for this to work. + template<typename _Tp> + struct _Concept<_Tp, true> + { + void __constraint() + { constexpr _Tp __obj; } + }; + + // Non-literal type, declare local static and verify no + // constructors generated for _Tp within the translation unit. + template<typename _Tp> + struct _Concept<_Tp, false> + { + void __constraint() + { static _Tp __obj; } + }; + 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; + _Concept<_Tp> c; + c.__constraint(); } }; struct constexpr_single_value_constructible { - // NB: _Tbasetype and _Ttesttype must be literal types. - template<typename _Ttesttype, typename _Tbasetype> - void - operator()() + template<typename _Ttesttype, typename _Tvaluetype, + bool _IsLitp = std::is_literal_type<_Ttesttype>::value> + struct _Concept; + + // NB: _Tvaluetype and _Ttesttype must be literal types. + // Additional constraint on _Tvaluetype 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. + template<typename _Ttesttype, typename _Tvaluetype> + struct _Concept<_Ttesttype, _Tvaluetype, true> { - struct _Concept + void __constraint() { - // 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); - } - }; + constexpr _Tvaluetype __v { }; + constexpr _Ttesttype __obj(__v); + } + }; - _Concept c; + template<typename _Ttesttype, typename _Tvaluetype> + struct _Concept<_Ttesttype, _Tvaluetype, false> + { + void __constraint() + { + const _Tvaluetype __v { }; + static _Ttesttype __obj(__v); + } + }; + + template<typename _Ttesttype, typename _Tvaluetype> + void + operator()() + { + _Concept<_Ttesttype, _Tvaluetype> c; c.__constraint(); } }; |