__has_operator_addressof.pass.cpp revision 01afa5c6e407e985d9643707d7b7ab1384bd9317
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
21struct A
22{
23};
24
25struct B
26{
27    constexpr B* operator&() const;
28};
29
30struct D;
31
32struct C
33{
34    template <class U>
35    D operator,(U&&);
36};
37
38struct E
39{
40    constexpr C operator&() const;
41};
42
43#endif  // _LIBCPP_HAS_NO_CONSTEXPR
44
45int 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