Re: [PATCH] [gdb/build] Fix cli/cli-style.c build error with C++20

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
On 8/12/26 10:54 PM, Tom de Vries wrote:
> PR build/34514 reports for a C++20 build:
> ...
> cli/cli-style.c:457:37: error: conversion from ‘const char8_t [8]’ to \
>   non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} \
>   requested
>   457 | static std::string warning_prefix = u8"\u26A0\uFE0F ";
>       |                                     ^~~~~~~~~~~~~~~~~
> ...
> 
> The u8 literal is char[] until C++20, but char8_t[] since C++20.
> 
> Fix this by using a reinterpret_cast<const char *>.
> 
> Tested by rebuilding using GCC 15.3.0, with and without -std=c++20.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34514

Seems fine to me, I don't see a better way around it, other than moving
back to having the emoji in the code.

Approved-By: Simon Marchi <[email protected]>

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.