Home | History | Annotate | Download | only in temp.deduct
      1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
      2 
      3 #if !__has_feature(cxx_access_control_sfinae)
      4 #  error No support for access control as part of SFINAE?
      5 #endif
      6 
      7 typedef char yes_type;
      8 typedef char (&no_type)[2];
      9 
     10 template<unsigned N> struct unsigned_c { };
     11 
     12 template<typename T>
     13 class has_copy_constructor {
     14   static T t;
     15 
     16   template<typename U> static yes_type check(unsigned_c<sizeof(U(t))> * = 0);
     17   template<typename U> static no_type check(...);
     18 
     19 public:
     20   static const bool value = (sizeof(check<T>(0)) == sizeof(yes_type));
     21 };
     22 
     23 struct HasCopy { };
     24 
     25 struct HasNonConstCopy {
     26   HasNonConstCopy(HasNonConstCopy&);
     27 };
     28 
     29 struct HasDeletedCopy {
     30   HasDeletedCopy(const HasDeletedCopy&) = delete;
     31 };
     32 
     33 struct HasPrivateCopy {
     34 private:
     35   HasPrivateCopy(const HasPrivateCopy&);
     36 };
     37 
     38 int check0[has_copy_constructor<HasCopy>::value? 1 : -1];
     39 int check1[has_copy_constructor<HasNonConstCopy>::value? 1 : -1];
     40 int check2[has_copy_constructor<HasDeletedCopy>::value? -1 : 1];
     41 int check3[has_copy_constructor<HasPrivateCopy>::value? -1 : 1];
     42