[Bug c++/86135] At run time, when the constructor tries to construct an objects element with a initializer-list (using c++11 style) is giving segmentation fault. The old style of initialize with parenthesis is working properly.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 13 18:01:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86135
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
http://en.cppreference.com/w/cpp/language/list_initialization#Notes shows a
similar example, demonstrating the different behaviour for initializer_list
constructors. std::vector has an initializer-list constructor, so trying to
move-construct a vector<object_t> when object_t can be constructed from
std::vector<object_t> will result in infinite recursion.
This special case only applies to list-initialization, because it's related to
constructors taking a std::initializer_list. It's totally wrong to say that
list-init and direct-init must do the same thing in the presence of
initializer-list constructors. If they did the same thing there would have been
no need to introduce list-initialization syntax in the first place.
More information about the Gcc-bugs
mailing list