Skip to content

Commit d39dabf

Browse files
committed
Fix gcc constexpr evaluation failure
1 parent ad2c052 commit d39dabf

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

libcxx/include/list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public:
354354

355355
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __base_pointer __as_link() {
356356
return pointer_traits<__base_pointer>::pointer_to(
357-
*static_cast<typename pointer_traits<__base_pointer>::element_type*>(this));
357+
*static_cast<typename pointer_traits<__base_pointer>::element_type*>(std::addressof(*this)));
358358
}
359359
};
360360

libcxx/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#include <list>
1414
#include <cassert>
15-
#include <type_traits>
1615

1716
#include "test_macros.h"
1817
#include "DefaultOnly.h"
@@ -35,7 +34,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
3534
assert(l.back() == 0);
3635
}
3736
#if TEST_STD_VER >= 11
38-
if (!std::is_constant_evaluated()) {
37+
if (!TEST_IS_CONSTANT_EVALUATED) {
3938
{
4039
std::list<DefaultOnly> l(10);
4140
l.resize(5);

libcxx/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ TEST_CONSTEXPR_CXX26 void test_emplacable_concept_with_alloc() {
174174
#endif
175175
}
176176

177-
TEST_CONSTEXPR_CXX26 void test_ctor_under_alloc() {
177+
void test_ctor_under_alloc() {
178178
#if TEST_STD_VER >= 11
179179
int arr1[] = {42};
180180
int arr2[] = {1, 101, 42};
@@ -205,7 +205,7 @@ TEST_CONSTEXPR_CXX26 void test_ctor_under_alloc() {
205205
#endif
206206
}
207207

208-
TEST_CONSTEXPR_CXX26 void test_ctor_under_alloc_with_alloc() {
208+
void test_ctor_under_alloc_with_alloc() {
209209
#if TEST_STD_VER >= 11
210210
int arr1[] = {42};
211211
int arr2[] = {1, 101, 42};

libcxx/test/std/containers/sequences/list/list.cons/size_type.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <list>
1414
#include <cassert>
1515
#include <cstddef>
16-
#include <type_traits>
1716

1817
#include "test_macros.h"
1918
#include "DefaultOnly.h"
@@ -88,7 +87,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
8887
assert(*i == 0);
8988
}
9089

91-
if (!std::is_constant_evaluated()) {
90+
if (!TEST_IS_CONSTANT_EVALUATED) {
9291
{
9392
std::list<DefaultOnly> l(3);
9493
assert(l.size() == 3);

libcxx/test/support/counting_predicates.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ struct unary_counting_predicate {
2828
++count_;
2929
return p_(a);
3030
}
31-
TEST_CONSTEXPR std::size_t count() const { return count_; }
32-
TEST_CONSTEXPR void reset() { count_ = 0; }
31+
TEST_CONSTEXPR_CXX14 std::size_t count() const { return count_; }
32+
TEST_CONSTEXPR_CXX14 void reset() { count_ = 0; }
3333

3434
private:
3535
Predicate p_;

0 commit comments

Comments
 (0)