[Lldb-commits] [lldb] [lldb-server] Fix constexpr-if-else static assert (PR #194394)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 27 07:56:59 PDT 2026


https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/194394

Some old compilers complained about the `static_assert(false)` pattern.

>From dcd87f766fe1fb29907f6b29a0e01a3959d6ff1f Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Mon, 27 Apr 2026 15:54:24 +0100
Subject: [PATCH] [lldb-server] Fix constexpr-if-else static assert

Some old compilers complained about the `static_assert(false)` pattern.
---
 .../gdb-remote/GDBRemoteCommunicationServerLLGS.cpp       | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index b7570aea61db3..44836ae3aa61c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3081,14 +3081,16 @@ GDBRemoteCommunicationServerLLGS::SendBreakpointResponse(
   return std::visit(
       [&](auto &&arg) {
         using T = std::decay_t<decltype(arg)>;
+        static_assert(std::is_same_v<T, BreakpointOK> ||
+                          std::is_same_v<T, BreakpointError> ||
+                          std::is_same_v<T, BreakpointIllFormed>,
+                      "non-exhaustive visitor!");
         if constexpr (std::is_same_v<T, BreakpointOK>)
           return SendOKResponse();
         else if constexpr (std::is_same_v<T, BreakpointError>)
           return SendErrorResponse(arg.error_code);
-        else if constexpr (std::is_same_v<T, BreakpointIllFormed>)
-          return SendIllFormedResponse(packet, arg.message.c_str());
         else
-          static_assert(false, "non-exhaustive visitor!");
+          return SendIllFormedResponse(packet, arg.message.c_str());
       },
       result);
 }



More information about the lldb-commits mailing list