libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

c1xx_broken_za_ctor_check.pass.cpp (999B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // Verify TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK.
     13 
     14 #include <type_traits>
     15 
     16 #include "test_workarounds.h"
     17 
     18 struct X {
     19     X(int) {}
     20 
     21     X(X&&) = default;
     22     X& operator=(X&&) = default;
     23 
     24 private:
     25     X(const X&) = default;
     26     X& operator=(const X&) = default;
     27 };
     28 
     29 void PushFront(X&&) {}
     30 
     31 template<class T = int>
     32 auto test(int) -> decltype(PushFront(std::declval<T>()), std::true_type{});
     33 auto test(long) -> std::false_type;
     34 
     35 int main() {
     36 #if defined(TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK)
     37     static_assert(!decltype(test(0))::value, "");
     38 #else
     39     static_assert(decltype(test(0))::value, "");
     40 #endif
     41 }