blob: 1c715e04970c742e8c58a5bf592f959a94dcd675 [file] [log] [blame]
Howard Hinnant01afa5c2013-09-02 20:30:37 +00001//===----------------------------------------------------------------------===//
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
Eric Fiselier341b5902014-11-05 20:59:18 +000043struct F {};
Eric Fiselier341b5902014-11-05 20:59:18 +000044constexpr F* operator&(F const &) { return nullptr; }
45
Eric Fiselierb6e0ef22014-11-05 21:20:10 +000046struct G {};
47constexpr G* operator&(G &&) { return nullptr; }
48
49struct H {};
50constexpr H* operator&(H const &&) { return nullptr; }
51
52struct J
53{
Marshall Clowcfeac662014-11-17 16:34:44 +000054 constexpr J* operator&() const &&;
Eric Fiselierb6e0ef22014-11-05 21:20:10 +000055};
56
Howard Hinnant01afa5c2013-09-02 20:30:37 +000057#endif // _LIBCPP_HAS_NO_CONSTEXPR
58
59int main()
60{
61#ifndef _LIBCPP_HAS_NO_CONSTEXPR
62 static_assert(std::__has_operator_addressof<int>::value == false, "");
63 static_assert(std::__has_operator_addressof<A>::value == false, "");
64 static_assert(std::__has_operator_addressof<B>::value == true, "");
65 static_assert(std::__has_operator_addressof<E>::value == true, "");
Eric Fiselier341b5902014-11-05 20:59:18 +000066 static_assert(std::__has_operator_addressof<F>::value == true, "");
Eric Fiselierb6e0ef22014-11-05 21:20:10 +000067 static_assert(std::__has_operator_addressof<G>::value == true, "");
68 static_assert(std::__has_operator_addressof<H>::value == true, "");
69 static_assert(std::__has_operator_addressof<J>::value == true, "");
Howard Hinnant01afa5c2013-09-02 20:30:37 +000070#endif // _LIBCPP_HAS_NO_CONSTEXPR
71}