Containers default initialization

Jonathan Wakely jwakely@redhat.com
Mon Jun 12 11:57:00 GMT 2017


On 10/06/17 16:44 +0200, François Dumont wrote:
>On 08/06/2017 15:22, Jonathan Wakely wrote:
>>Can't we just have one file per container type (maybe just called
>>default_init.cc) which tests default-initialization in test01() and
>>value-initialization in a test02() function?
>>
>While working on this weird behavior I wanted to always test the 2 
>types of init. If they were in the same file the 1st failure would 
>stop the tests. Do you really want them in the same file ?

But the desired situation is that there are no failures, so the tests
don't stop. So they can be in the same file. If either case starts to
fail then we need to investigate and fix it, which is true whether
it's in one file or two.

>But is there any dg-xxx flag to put to indicate a failing test for 
>known reason ? Or should I simply keep the test on my desktop waiting 
>for the compiler fix ?

You can use the following to make the expected result XFAIL:

{ dg-xfail-run-if "PR c++/65816" { *-*-* } }

When the bug gets fixed the tests will start to XPASS and we can
remove that directive.

The DejaGnu directives supported by the GCC testsuites are documented
at https://gcc.gnu.org/onlinedocs/gccint/Directives.html

>Attach is the new patch tested under Linux x86_64 normal mode. Note 
>that I added a simplification of the _M_get_Node_allocator(), 
>static_cast is useless no ?

In this case, yes. In general a static_cast from one pointer type to
another pointer type cannot use user-defined conversion operators, so
is safer in some cases in generic code.

>Ok to commit ?

OK, thanks.



More information about the Libstdc++ mailing list