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

Work around GCC12 bug involving the use of declval.

This commit is contained in:
Zach Laine
2024-01-13 21:26:49 -06:00
parent 6a2a1229a4
commit 16cd1894e2
2 changed files with 7 additions and 8 deletions

View File

@@ -7890,11 +7890,10 @@ namespace boost { namespace parser {
char const *,
context_t,
skipper_t> const;
using all_types = decltype(detail::hl::transform(
parsers, std::declval<use_parser_t>()));
auto all_types_wrapped =
detail::hl::transform(all_types{}, detail::wrap{});
auto first_non_nope = detail::hl::fold_left(
using all_types =
decltype(hl::transform(parsers, std::declval<use_parser_t>()));
auto all_types_wrapped = hl::transform(all_types{}, detail::wrap{});
auto first_non_nope = hl::fold_left(
all_types_wrapped,
wrapper<nope>{},
[=](auto result, auto type) {
@@ -7906,11 +7905,11 @@ namespace boost { namespace parser {
});
using first_t = typename decltype(first_non_nope)::type;
static_assert(
!detail::is_nope_v<first_t>,
!is_nope_v<first_t>,
"It looks like you wrote merge[p1 >> p2 >> ... pn], and none "
"of the parsers p1, p2, ... pn produces an attribute. Please "
"fix.");
detail::hl::for_each(all_types_wrapped, [=]<class T>(T type) {
hl::for_each(all_types_wrapped, [=]<class T>(T type) {
using t = typename T::type;
if constexpr (!is_nope_v<t>) {
static_assert(

View File

@@ -185,7 +185,7 @@ namespace boost { namespace parser {
template<typename T>
operator T() const && noexcept
{
#if defined(__GNUC__) && __GNUC__ < 12
#if defined(__GNUC__) && __GNUC__ < 13
// Yuck.
std::remove_reference_t<T> * ptr = nullptr;
ptr += 1; // warning mitigation