From 5b8f9c40dd9d6a07ec636590e78c2f49d28624b9 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Sat, 23 Dec 2023 03:58:31 -0500 Subject: [PATCH] Fix use-out-of-constexpr lifetime detected by prerelease MSVC (#1312) This was originally reported by @Zhaojun-Liu of Beyondsoft . This fix was suggested by @joemmett of the compiler frontend team. --- src/vcpkg/commands.build.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vcpkg/commands.build.cpp b/src/vcpkg/commands.build.cpp index ea84b78582..df2e34727f 100644 --- a/src/vcpkg/commands.build.cpp +++ b/src/vcpkg/commands.build.cpp @@ -1484,9 +1484,9 @@ namespace vcpkg void append_log(const Path& path, const std::string& log, size_t max_log_length, std::string& out) { - StringLiteral details_start = "
{}\n\n```\n"; - StringLiteral skipped_msg = "\n...\nSkipped {} lines\n..."; - StringLiteral details_end = "\n```\n
\n\n"; + static constexpr StringLiteral details_start = "
{}\n\n```\n"; + static constexpr StringLiteral skipped_msg = "\n...\nSkipped {} lines\n..."; + static constexpr StringLiteral details_end = "\n```\n
\n\n"; const size_t context_size = path.native().size() + details_start.size() + details_end.size() + skipped_msg.size() + 6 /* digits for skipped count */; const size_t minimum_log_size = std::min(size_t{100}, log.size());