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