http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51336

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 
2011-11-28 20:49:52 UTC ---
(In reply to comment #0)
> #include <type_traits>
> template<class T>
> struct A {
>         template<class=typename
> std::enable_if<std::is_same<T,int>::value>::type>
>                 A(A const&){}
> };
> constexpr bool b = std::is_abstract<A<double>>::value;

I *think* the compiler is right to reject this as it currently does, we have
*no* sfinae here. When you instantiate A<double>, the declaration of the
template constructor is also instantiated, but at that point A<double> is an
incomplete type.

IMO you need one further indirection, e.g.

template<class T>
struct A {
  template<class U = T, class = typename
    std::enable_if<std::is_same<U, int>::value>::type
  >
  A(A const&){}
};

Btw.: Neither of these forms can ever prevent the "real" copy constructor to be
declared, defined, and used by the compiler.

> I am not sure what is supposed to happen (that's why I tried), but this result
> doesn't seem right. Filed under C++ because is_abstract directly forwards to
> the __is_abstract builtin, but feel free to reassign to libstdc++ if you think
> the problem is there somehow.

Lets look what the compiler-intrinsic people say, above is my first guess on
that.

Reply via email to