[Bug c++/51336] [C++11] is_abstract and sfinae

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 29 11:26:00 GMT 2011


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

--- Comment #7 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-11-29 10:50:37 UTC ---
(In reply to comment #5)
> All right, now the is_abstract behavior is settled, do you think the fixed code
> provided by Daniel in comment #1 should produce a warning, since the
> declaration is absolutely useless (I may be missing something)? 

IMO a warning could be very useful here (at least in circumstances where the
constructor is never reachable).

> Or maybe there are legitimate meta-programming tricks I am not thinking of that 
> would turn regular constructors into pseudo copy constructors to disable them?

While it seems that the current defect in regard to concept-constrained member
functions mentioned in c++std-core-20783 is a defect, so that

template<ObjectType T>
class A {
 requires SomeConcept<T>
 A(const A&) {}
};

is *intended* to work, I currently see no such chance for sfinae-constrained
special-member functions - unless the new temploid nomenclature shows that in

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

A<T>::A(A const&) is considered as a temploid as well. I stay tuned to see how
"temploids" will be defined...

Your suggested addition of a copy-constructor to non-const is surely useful in
some cases, but I think the emulation is imperfect. Just consider that you try
to copy from a source that is not const.



More information about the Gcc-bugs mailing list