From f33a7274f310e8d5e21e1f7c3a9ac26580177a11 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 20 Mar 2024 15:02:32 +0200
Subject: [PATCH 34/34] Fix C++20 capture this semantics configure check

It was failing due to "unused 'this'" even when it should
have succeeded.

See RM #328

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 m4/c++20.m4 | 2 +-
 meson.build | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/c++20.m4 b/m4/c++20.m4
index 261b0873b8..ac1d2a9a13 100644
--- a/m4/c++20.m4
+++ b/m4/c++20.m4
@@ -11,7 +11,7 @@ AC_DEFUN([FC_CXX20_CAPTURE_THIS],
        CXXFLAGS="$CXXFLAGS $WERROR_CXX_TEST_FLAGS"
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[class me {
 void top(); };
-void me::top() { [=, this]() {}; };
+void me::top() { (void) [=, this]() { this->top(); }; };
 ]])],
 [ac_cv_cxx20_capture_this=yes], [ac_cv_cxx20_capture_this=no])
        CXXFLAGS="$_CXXFLAGS"
diff --git a/meson.build b/meson.build
index 048abef25b..5d09961b5d 100644
--- a/meson.build
+++ b/meson.build
@@ -956,7 +956,7 @@ endif
 if cxx_build and cxx_compiler.compiles('''
 class me {
 void top(); };
-void me::top() { [=, this]() {}; };
+void me::top() { (void) [=, this]() { this->top(); }; };
 ''',
      name: 'C++20 capture this',
      args: ['-Werror', '-Wall'])
-- 
2.43.0

