lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 2814dec 11/28: Check for comparison operator


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2814dec 11/28: Check for comparison operator defaulting in configure C++ test
Date: Wed, 12 May 2021 18:14:43 -0400 (EDT)

branch: master
commit 2814dec061912eda3c68dc3b28bfd629635c50db
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Check for comparison operator defaulting in configure C++ test
    
    Verify that defaulting operator<=>() really works, as this is required
    by lmi now.
---
 configure.ac | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index cf2844d..1788619 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,12 @@ m4_define([lmi_cxx_feature_test], [[
 #elif __cplusplus <= 201402L
 #error At least C++17 is required.
 #else
-struct S { int x = 0; double y = 0.0; };
+#include <compare>
+struct S {
+    int x = 0;
+    double y = 0.0;
+    auto operator<=>(S const&) const = default;
+};
 S s = {.x = 1, .y = 2.0};
 static_assert(true);
 #endif
@@ -163,6 +168,14 @@ if test "$lmi_cv_cxx_features" = "no"; then
             AC_MSG_ERROR([Can't enable C++20 support required for building 
lmi.])
         )]
     )
+
+    dnl Final sanity check: our test code must compile in C++20.
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([lmi_cxx_feature_test])],
+        [],
+        [AC_MSG_ERROR([Compiler ($CXX $CXXFLAGS) doesn't support required 
C++20 features.])]
+        )
+    AC_LANG_POP([C++])
 fi
 
 dnl These options must be always used for lmi unit tests to pass.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]