Re: This doesn't compile is it a bug or a mistake on my part.
Am 29.09.2013 10:01, schrieb monamimani@googlemail.com:
I get errors when compiling this simple code using top of tree clang
(28-Sept-2013) and if I remove the noexcept I don't get the error:
#include<vector>
#include<string>
class Foo
{
public:
protected:
Foo(Foo&&) noexcept = default;
Foo& operator=(Foo&&) noexcept = default;
Foo()
{
}
private:
std::vector<std::string> vectorFoo_;
};
This is the errors I get, I understand it is in the instantiation of
the exception specification, but I doubt the std::string is not
nothrow move constructible,.. the first error make me think there is
a bug.
It is not a bug of the library you are testing. You are right, that
std::string is nothrow move constructible, see
basic_string(basic_string&& str) noexcept;
but for std::vector this guarantee is not given, see
vector(vector&&);
I agree that the latter is unfortunate and this could be submitted as
a library issue. Nonetheless fixing that would not resolve you problem
in regard to the move assignment operations, because these functions
have a conditional situation (depending on the allocator's
propagate_on_container_move_assignment value). Furthermore
std::string's nothrow guarantee of move-assignment will presumably be
changed, see
http://cplusplus.github.io/LWG/lwg-active.html#2063
HTH & Greetings from Bremen
Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]