Mercurial > hg > CbC > CbC_llvm
comparison clang/test/SemaCXX/builtins.cpp @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | 0572611fdcc8 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
220:42394fc6a535 | 221:79ff65ed7e25 |
---|---|
111 constexpr const int *const_ptr = test_constexpr_launder(&const_int); | 111 constexpr const int *const_ptr = test_constexpr_launder(&const_int); |
112 static_assert(&const_int == const_ptr, ""); | 112 static_assert(&const_int == const_ptr, ""); |
113 static_assert(const_ptr != test_constexpr_launder(&const_int2), ""); | 113 static_assert(const_ptr != test_constexpr_launder(&const_int2), ""); |
114 | 114 |
115 void test_non_constexpr() { | 115 void test_non_constexpr() { |
116 constexpr int i = 42; // expected-note {{declared here}} | 116 constexpr int i = 42; // expected-note {{address of non-static constexpr variable 'i' may differ on each invocation}} |
117 constexpr const int *ip = __builtin_launder(&i); // expected-error {{constexpr variable 'ip' must be initialized by a constant expression}} | 117 constexpr const int *ip = __builtin_launder(&i); // expected-error {{constexpr variable 'ip' must be initialized by a constant expression}} |
118 // expected-note@-1 {{pointer to 'i' is not a constant expression}} | 118 // expected-note@-1 {{pointer to 'i' is not a constant expression}} |
119 } | 119 } |
120 | 120 |
121 constexpr bool test_in_constexpr(const int &i) { | 121 constexpr bool test_in_constexpr(const int &i) { |
142 void test_noexcept(int *i) { | 142 void test_noexcept(int *i) { |
143 static_assert(noexcept(__builtin_launder(i)), ""); | 143 static_assert(noexcept(__builtin_launder(i)), ""); |
144 } | 144 } |
145 #undef TEST_TYPE | 145 #undef TEST_TYPE |
146 } // end namespace test_launder | 146 } // end namespace test_launder |
147 | |
148 template<typename T> void test_builtin_complex(T v, double d) { | |
149 (void)__builtin_complex(v, d); // expected-error {{different types}} expected-error {{not a real floating}} | |
150 (void)__builtin_complex(d, v); // expected-error {{different types}} expected-error {{not a real floating}} | |
151 (void)__builtin_complex(v, v); // expected-error {{not a real floating}} | |
152 } | |
153 template void test_builtin_complex(double, double); | |
154 template void test_builtin_complex(float, double); // expected-note {{instantiation of}} | |
155 template void test_builtin_complex(int, double); // expected-note {{instantiation of}} |