[Bug cli/34514] cli-style.c build failu re (error: conversion from ‘const char8_t [ 8]’ to non-scalar type ‘std::string’ {a ka ‘std::__cxx11::basic_string<char>’} re quested)

"cvs-commit at gcc dot gnu.org via Gdb-prs" <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34514

--- Comment #2 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <[email protected]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f33422af6d81c623871f1407e2fce0794e90739a

commit f33422af6d81c623871f1407e2fce0794e90739a
Author: Tom de Vries <[email protected]>
Date:   Thu Aug 13 05:23:09 2026 +0200

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

    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.

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

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34514

-- 
You are receiving this mail because:
You are on the CC list for the bug.
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.