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

--- Comment #6 from Frank Heckenbach <f.heckenb...@fh-soft.de> ---
Tried to use a self-written (simple) container as a stop-gap, but it also fell
prey to this bug. Daniel Krügler wrote: "std::vector's copy constructor is not
SFINAE-friendly and causes std::is_copy_constructible to evaluate to true
regradless of it's element type." The same seems to be true for my container.
Here's a very reduced example that shows the bug:

#include <type_traits>

struct MoveOnly
{
  MoveOnly (MoveOnly &&) = default;
};

template <typename T> struct s
{
  T v;
  s (const s &a): v (a.v) { }
};

using T = s <MoveOnly>;

int main ()
{
  static_assert (!std::is_copy_constructible <T>::value, "bug");
  T *a, b (*a);  // correct error here shows T is not copy-constructible
}

So I guess "not SFINAE-friendly" means that the copy constructor is declared
unconditionally, even if it can't be instantiated due to T not being copyable,
right? Does this mean I need to endow my copy constructor with enable_if (with
all the ugliness that brings), or are there better workarounds (until the
bugfix makes it into a release)?

Reply via email to