[Bug libstdc++/80654] is_trivially_copy_constructible fails with compiler error with vector of uncopyable objects
f.heckenbach@fh-soft.de
gcc-bugzilla@gcc.gnu.org
Mon Apr 2 00:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654
--- Comment #9 from Frank Heckenbach <f.heckenbach@fh-soft.de> ---
Found another possible workaround: "Lie" to the compiler (though is it lying
when you're actually telling it the truth? ;) by specializing
std::is_trivially_copy_constructible like this (of course, one needs to repeat
it for all affected types, e.g. other containers and other non-copyable value
types):
namespace std
{
template <typename T> struct
is_trivially_copy_constructible<std::vector<std::unique_ptr<T>>>: false_type {
};
}
I guess it's totally illegal to put such a specialization into std, but
realistically, can anything bad happen, seeing that it just injects a correct
answer where the default is buggy?
More information about the Gcc-bugs
mailing list