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 // type_traits 11 12 // extension 13 14 // template <typename _Tp> struct __has_operator_addressof 15 16 17 #include <type_traits> 18 19 #ifndef _LIBCPP_HAS_NO_CONSTEXPR 20 21 struct A 22 { 23 }; 24 25 struct B 26 { 27 constexpr B* operator&() const; 28 }; 29 30 struct D; 31 32 struct C 33 { 34 template <class U> 35 D operator,(U&&); 36 }; 37 38 struct E 39 { 40 constexpr C operator&() const; 41 }; 42 43 #endif // _LIBCPP_HAS_NO_CONSTEXPR 44 45 int main() 46 { 47 #ifndef _LIBCPP_HAS_NO_CONSTEXPR 48 static_assert(std::__has_operator_addressof<int>::value == false, ""); 49 static_assert(std::__has_operator_addressof<A>::value == false, ""); 50 static_assert(std::__has_operator_addressof<B>::value == true, ""); 51 static_assert(std::__has_operator_addressof<E>::value == true, ""); 52 #endif // _LIBCPP_HAS_NO_CONSTEXPR 53 } 54