Discussion:
[PATCH] PR libstdc++/60132, implement the remaining C++11 is_trivially_* traits
Ville Voutilainen
2014-10-08 20:28:25 UTC
Permalink
Tested on Linux-X64.

Massive thanks to Jason for doing the heavy lifting on the front-end side.

2014-10-08 Ville Voutilainen <***@gmail.com>

PR libstdc++/60132
* include/std/type_traits (is_trivially_copyable,
is_trivially_constructible, is_trivially_default_constructible,
is_trivially_copy_constructible, is_trivially_move_constructible,
is_trivially_assignable, is_trivially_copy_assignable,
is_trivially_move_assignable): New.
* testsuite/20_util/is_trivially_assignable/requirements/typedefs.cc: New.
* testsuite/20_util/is_trivially_assignable/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_assignable/value.cc: New.
* testsuite/20_util/is_trivially_constructible/requirements/typedefs.cc:
New.
* testsuite/20_util/is_trivially_constructible/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_constructible/value.cc: New.
* testsuite/20_util/is_trivially_copyable/requirements/typedefs.cc: New.
* testsuite/20_util/is_trivially_copyable/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_copyable/value.cc: New.
* testsuite/20_util/is_trivially_copy_assignable/requirements/typedefs.cc:
New.
* testsuite/20_util/is_trivially_copy_assignable/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_copy_assignable/value.cc: New.
* testsuite/20_util/is_trivially_copy_constructible/requirements/typedefs.cc:
New.
* testsuite/20_util/is_trivially_copy_constructible/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_copy_constructible/value.cc: New.
* testsuite/20_util/is_trivially_default_constructible/requirements/typedefs.cc:
New.
* testsuite/20_util/is_trivially_default_constructible/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_default_constructible/value.cc: New.
* testsuite/20_util/is_trivially_move_assignable/requirements/typedefs.cc:
New.
* testsuite/20_util/is_trivially_move_assignable/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_move_assignable/value.cc: New.
* testsuite/20_util/is_trivially_move_constructible/requirements/typedefs.cc:
New.
* testsuite/20_util/is_trivially_move_constructible/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_trivially_move_constructible/value.cc: New.
Jonathan Wakely
2014-10-08 22:45:10 UTC
Permalink
Post by Ville Voutilainen
PR libstdc++/60132
* include/std/type_traits (is_trivially_copyable,
is_trivially_constructible, is_trivially_default_constructible,
is_trivially_copy_constructible, is_trivially_move_constructible,
is_trivially_assignable, is_trivially_copy_assignable,
is_trivially_move_assignable): New.
* testsuite/20_util/is_trivially_assignable/requirements/typedefs.cc: New.
New.
Some of the tests have copyright dates of 2012-2014 - I think they
should be just 2014, even if you copied existing files.

Please break the ChangeLog entries to fit in 80 columns, e.g.

* testsuite/20_util/is_trivially_assignable/requirements/
explicit_instantiation.cc: New.


Other than those minor points this is OK for trunk, thanks very much!
Ville Voutilainen
2014-10-09 06:10:10 UTC
Permalink
Post by Jonathan Wakely
Some of the tests have copyright dates of 2012-2014 - I think they
should be just 2014, even if you copied existing files.
Some of them also had 010 as the month. :)
Post by Jonathan Wakely
Please break the ChangeLog entries to fit in 80 columns, e.g.
* testsuite/20_util/is_trivially_assignable/requirements/
explicit_instantiation.cc: New.
Other than those minor points this is OK for trunk, thanks very much!
Ok, another try (I don't have write-after-approval, so please commit the patch
once you think it's ok):

2014-10-09 Ville Voutilainen <***@gmail.com>

PR libstdc++/60132
* include/std/type_traits (is_trivially_copyable,
is_trivially_constructible, is_trivially_default_constructible,
is_trivially_copy_constructible, is_trivially_move_constructible,
is_trivially_assignable, is_trivially_copy_assignable,
is_trivially_move_assignable): New.
* testsuite/20_util/is_trivially_assignable/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_assignable/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_assignable/
value.cc: New.
* testsuite/20_util/is_trivially_constructible/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_constructible/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_constructible/value.cc: New.
* testsuite/20_util/is_trivially_copyable/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_copyable/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_copyable/
value.cc: New.
* testsuite/20_util/is_trivially_copy_assignable/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_copy_assignable/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_copy_assignable/value.cc: New.
* testsuite/20_util/is_trivially_copy_constructible/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_copy_constructible/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_copy_constructible/value.cc: New.
* testsuite/20_util/is_trivially_default_constructible/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_default_constructible/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_default_constructible/value.cc: New.
* testsuite/20_util/is_trivially_move_assignable/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_move_assignable/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_move_assignable/value.cc: New.
* testsuite/20_util/is_trivially_move_constructible/requirements/
typedefs.cc: New.
* testsuite/20_util/is_trivially_move_constructible/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_trivially_move_constructible/value.cc: New.
Paolo Carlini
2014-10-09 08:25:38 UTC
Permalink
Hi,
Post by Ville Voutilainen
Ok, another try (I don't have write-after-approval, so please commit
Thanks Ville from me too. I'm taking care of the commit with a few very
minor tweaks:
1- In new library testcases we are consistently using -std=gnu++11 and
-std=gnu++14 (because the C++98 default is -std=gnu++98)
2- Uniform the dates to 2014-10-09.
3- Adjust the dg-error line numbers of 3 *_neg.cc testcases.

Thanks again,
Paolo.

////////////////
Jonathan Wakely
2014-10-09 18:18:01 UTC
Permalink
Now that we have is_trivially_copyable ...

Update the docs and fix a TODO in <atomic>.

I asked Doug Gregor recently about the __is_location_invariant trait
that he used in our std::tr1::function and std::function
implementations and he confirmed that in C++11
std::is_trivially_copyable is a better test.

Ville pointed out on IRC that we might also be able to use it in
<bits/stl_algobase.h> instead of __is_trivial but I haven't
investigated that properly.

Tested x86_64-linux, committed to trunk.

Loading...