[Bug libstdc++/87809] [8/9 Regression] Can't create empty std::optional<std::vector<int, CustomAlloc>>

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 30 14:50:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87809

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Oct 30 14:49:43 2018
New Revision: 265626

URL: https://gcc.gnu.org/viewcvs?rev=265626&root=gcc&view=rev
Log:
PR libstdc++/87809 avoid invalid expressions in exception specifications

If the allocator isn't default constructible then checking if the
default constructor throws in an exception specification makes the
declaration invalid. Use the type trait instead.

        PR libstdc++/87809
        * include/bits/forward_list.h (_Fwd_list_impl::_Fwd_list_impl()): Use
        trait in exception-specification instead of possibly invalid
        expression.
        * include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl()):
        Likewise.
        * include/bits/stl_list.h (_List_impl::_List_impl()): Likewise.
        * include/bits/stl_vector.h (_Vector_impl::_Vector_impl()): Likewise.
        * testsuite/23_containers/forward_list/cons/87809.cc: New test.
        * testsuite/23_containers/list/cons/87809.cc: New test.
        * testsuite/23_containers/vector/bool/cons/87809.cc: New test.
        * testsuite/23_containers/vector/cons/87809.cc: New test.

Added:
    trunk/libstdc++-v3/testsuite/23_containers/forward_list/cons/87809.cc
    trunk/libstdc++-v3/testsuite/23_containers/list/cons/87809.cc
    trunk/libstdc++-v3/testsuite/23_containers/vector/bool/cons/87809.cc
    trunk/libstdc++-v3/testsuite/23_containers/vector/cons/87809.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/forward_list.h
    trunk/libstdc++-v3/include/bits/stl_bvector.h
    trunk/libstdc++-v3/include/bits/stl_list.h
    trunk/libstdc++-v3/include/bits/stl_vector.h


More information about the Gcc-bugs mailing list