Home | History | Annotate | Download | only in class
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
      2 // expected-no-diagnostics
      3 
      4 class Trivial { int n; void f(); };
      5 class NonTrivial1 { NonTrivial1(const NonTrivial1 &); };
      6 class NonTrivial2 { NonTrivial2(NonTrivial2 &&); };
      7 class NonTrivial3 { NonTrivial3 operator=(const NonTrivial3 &); };
      8 class NonTrivial4 { NonTrivial4 operator=(NonTrivial4 &&); };
      9 class NonTrivial5 { ~NonTrivial5(); };
     10 
     11 static_assert(__is_trivial(Trivial), "Trivial is not trivial");
     12 static_assert(!__is_trivial(NonTrivial1), "NonTrivial1 is trivial");
     13 static_assert(!__is_trivial(NonTrivial2), "NonTrivial2 is trivial");
     14 static_assert(!__is_trivial(NonTrivial3), "NonTrivial3 is trivial");
     15 static_assert(!__is_trivial(NonTrivial4), "NonTrivial4 is trivial");
     16 static_assert(!__is_trivial(NonTrivial5), "NonTrivial5 is trivial");
     17 
     18 struct Trivial2 {
     19   Trivial2() = default;
     20   Trivial2(const Trivial2 &) = default;
     21   Trivial2(Trivial2 &&) = default;
     22   Trivial2 &operator=(const Trivial2 &) = default;
     23   Trivial2 &operator=(Trivial2 &&) = default;
     24   ~Trivial2() = default;
     25 };
     26 
     27 class NonTrivial6 { ~NonTrivial6(); };
     28 
     29 NonTrivial6::~NonTrivial6() = default;
     30 
     31 static_assert(!__is_trivial(NonTrivial6), "NonTrivial6 is trivial");
     32