2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00

Multiple fixes for the structured bindings pack implementation (#221)

This commit is contained in:
Antony Polukhin
2025-09-11 21:51:07 +03:00
committed by GitHub
parent d9fde1f2a0
commit fc2dba87d6
10 changed files with 70 additions and 69 deletions

View File

@@ -54,7 +54,7 @@ local REQUIRE_LOOPHOLE =
;
local REQUIRE_VSB =
[ check-target-builds ../core//compiler_supports_vsb : : <build>no ]
;
;
local VARIADIC_STRUCTURED_BINDING_ENGINE = <define>BOOST_PFR_USE_LOOPHOLE=0 <define>BOOST_PFR_USE_CPP17=0 <define>BOOST_PFR_USE_CPP26=1 $(REQUIRE_VSB) ;
local STRUCTURED_BINDING_ENGINE = <define>BOOST_PFR_USE_LOOPHOLE=0 <define>BOOST_PFR_USE_CPP17=1 <define>BOOST_PFR_USE_CPP26=0 [ requires cxx17_structured_bindings ] ;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2024 Antony Polukhin
// Copyright (c) 2024-2025 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -9,11 +9,7 @@
#include <cstdint>
#if defined(__clang__)
# if SIZE_MAX > (1ULL << 32) - 1
# define ARRAY_MAX (SIZE_MAX >> 3)
# else
# define ARRAY_MAX SIZE_MAX
# endif
# define ARRAY_MAX INT_MAX
# define OBJECT_MAX SIZE_MAX
#elif defined(__GNUC__)
# define ARRAY_MAX INT_MAX

View File

@@ -23,7 +23,7 @@ int main() {
// FIXME: https://github.com/boostorg/pfr/issues/131
#if defined(__clang__) && __cplusplus >= 202002L
# if BOOST_PFR_USE_LOOPHOLE == 0 && BOOST_PFR_USE_CPP17 == 0
# if BOOST_PFR_USE_LOOPHOLE == 0 && BOOST_PFR_USE_CPP17 == 0 && BOOST_PFR_USE_CPP26 == 0
# error This test should fail on classic engine
#endif

View File

@@ -18,8 +18,8 @@ struct aggr {
zero_array a;
};
static_assert(sizeof(zero_array) == 0);
static_assert(sizeof(aggr) == 0);
static_assert(sizeof(zero_array) == 0, "");
static_assert(sizeof(aggr) == 0, "");
int main() {
aggr a;

View File

@@ -6,6 +6,11 @@
// Detection of variadic structured binding support
#include <type_traits>
#include <version>
#if !(__cpp_structured_bindings >= 202411L && __cpp_lib_forward_like >= 202207L)
#error Compiler does not support the required features
#endif
struct MyPair {
int first;
@@ -21,3 +26,4 @@ auto test() {
int main() {
return ::test<MyPair>();
}