Example #1
0
 bool
 f()
 { return !!__has_nothrow_assign(T); }
Example #2
0
    bool
    f()
    { return !!__has_nothrow_assign(T); }
  };

template<typename T>
  class My2
  {
  public:
    static const bool trait = __has_nothrow_assign(T);
  };

template<typename T>
  const bool My2<T>::trait;

template<typename T, bool b = __has_nothrow_assign(T)>
  struct My3_help
  { static const bool trait = b; };

template<typename T, bool b>
  const bool My3_help<T, b>::trait;

template<typename T>
  class My3
  {
  public:
    bool
    f()
    { return My3_help<T>::trait; }
  };
// PR c++/39475

struct I; // { dg-error "forward declaration" }
struct C { };

bool nas1 = __has_nothrow_assign(I); // { dg-error "incomplete type" }
bool nas2 = __has_nothrow_assign(C[]);
bool nas3 = __has_nothrow_assign(I[]); // { dg-error "incomplete type" }
bool nas4 = __has_nothrow_assign(void);
bool nas5 = __has_nothrow_assign(const void);

bool tas1 = __has_trivial_assign(I); // { dg-error "incomplete type" }
bool tas2 = __has_trivial_assign(C[]);
bool tas3 = __has_trivial_assign(I[]); // { dg-error "incomplete type" }
bool tas4 = __has_trivial_assign(void);
bool tas5 = __has_trivial_assign(const void);

bool nco1 = __has_nothrow_constructor(I); // { dg-error "incomplete type" }
bool nco2 = __has_nothrow_constructor(C[]);
bool nco3 = __has_nothrow_constructor(I[]); // { dg-error "incomplete type" }
bool nco4 = __has_nothrow_constructor(void);
bool nco5 = __has_nothrow_constructor(const void);

bool tco1 = __has_trivial_constructor(I); // { dg-error "incomplete type" }
bool tco2 = __has_trivial_constructor(C[]);
bool tco3 = __has_trivial_constructor(I[]); // { dg-error "incomplete type" }
bool tco4 = __has_trivial_constructor(void);
bool tco5 = __has_trivial_constructor(const void);

bool ncp1 = __has_nothrow_copy(I); // { dg-error "incomplete type" }
bool ncp2 = __has_nothrow_copy(C[]);
bool f () { return __has_nothrow_assign (S); }
int main ()
{
  assert (__has_nothrow_assign (S) == f ());
  return 0;
}
Example #6
0
 concept bool Nothrow_assignable() { return __has_nothrow_assign(T); }