[clang] [clang] Fix error in gcc 7.5. on arm32-linux (PR #73702)

Steven Johnson via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 13:46:16 PST 2023


https://github.com/steven-johnson created https://github.com/llvm/llvm-project/pull/73702

Apparently the gcc 7.5 compiler for arm32-linux fails to implicitly convert to std::optional; this inserts an explicit constructor to unbreak that compiler. [Injection from https://reviews.llvm.org/rG4142a64ae3ca4856e6a5ffae9e40014ef5cf9db5]

>From 87af40c987eb546bc3a3f022256d6d3b23340307 Mon Sep 17 00:00:00 2001
From: Steven Johnson <srj at google.com>
Date: Tue, 28 Nov 2023 13:44:00 -0800
Subject: [PATCH] [clang] Fix error in gcc 7.5. on arm32-linux

Apparently the gcc 7.5 compiler for arm32-linux fails to implicitly convert to std::optional; this inserts an explicit constructor to unbreak that compiler.
---
 clang/lib/Sema/SemaDeclCXX.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 7385eac48d8c895..f80de2b88b5ef68 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -17299,7 +17299,7 @@ bool Sema::EvaluateStaticAssertMessageAsString(Expr *Message,
                                     OverloadCandidateSet::CSK_Normal);
     if (MemberLookup.empty())
       return std::nullopt;
-    return std::move(MemberLookup);
+    return std::move(std::optional<LookupResult>(MemberLookup));
   };
 
   bool SizeNotFound, DataNotFound;



More information about the cfe-commits mailing list