This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: c++0x tests fixes
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: François Dumont <francois dot cppdevs at free dot fr>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Mon, 29 Nov 2010 22:45:20 +0100
- Subject: Re: c++0x tests fixes
- References: <4CF40FDF.7080201@free.fr>
Hi,
> This is some feedback on tests run in C++0x mode with or without
> debug mode.
>
> First failures without debug mode:
>
> 23_containers/vector/cons/4.cc
> 23_containers/deque/cons/2.cc
>
> The code was calling vector and deque constructor taking a size.
> Before C++0x it meant contruct N instances as the copy of a default
> constructed instance. In C++0x it means contruct N default constructed
> instance. I change the code to make copy constructor invocation explicit.
The changes to the testcases are fine. Please post the ChangeLog entry
and send the patch to gcc-patches too. In principle it would be a good
idea to also add a testcase for the behavior mandated by C++0x in terms
of number of copies. At the time, I think I added C++0x testcases, but
only checking that default-constructible, non-copy-constructible types
are fine.
> 23_containers/deque/requirements/explicit_instantiation/2.cc
> 23_containers/list/requirements/explicit_instantiation/2.cc
> 23_containers/vector/requirements/explicit_instantiation/2.cc
>
> The problem is simply that in C++0x mode deque/list/vector
> containers cannot be explicitely instanciated with non default
> constructible types. Is it a known fact ?
Sure it is. I also asked the reflector at some point.
> If so I think I will introduce a dg-require-no-experimental-mode to
> ignore those tests in this mode.
Seems a bit overkill to me.
> Now 2 debug specific failures:
>
> 23_containers/deque/types/1.cc
> 23_containers/vector/types/1.cc
>
> There is an ambiguity because of an internal iterator check using
> operator -(). Both operator-() from the test file itself and the one
> for move_iterator could be used. IMO this is again the problem of
> current algo design regarding debug mode, the same function is a debug
> version or not depending on _GLIBCXX_DEBUG macro rather than having 2
> versions of the function in difference namespace. With this split
> normal containers hidden behind debug ones could use normal algos.
> This is a big modif for libstdc++ so for the moment I only bypass
> debug check by replacing usage of std::copy in __uninit_copy by a
> direct use of __copy_move_a2. Normally when calling internal
> __uninit_copy function debug checks must already have been performed
> so there is no debug more regression.
In my opinion, if we want to improve move_iterator to be more robust vs
this kind of template abuses, a better solution is adding an overload of
operator- for iterators of the same type, like happens already for
__normal_iterator and deque::iterator. Actually, I would suggest dealing
with this issue separately and for reverse_iterator too, in a consistent
way, irrespective of debug-mode: constructing testcases should be in
general pretty easy...
Thanks,
Paolo.