mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 12:00:11 -05:00
When working on reflection, I've noticed that while we correctly translate
__FUNCTION__ content into the execution charset, for C++ we don't translate
__PRETTY_FUNCTION__ content and leave it in the SOURCE_CHARSET encoding:
const char *
file ()
{
return __FILE__;
}
const char *
func ()
{
return __func__;
}
const char *
function ()
{
return __FUNCTION__;
}
const char *
pretty_function ()
{
return __PRETTY_FUNCTION__;
}
./cc1 -quiet -fexec-charset=IBM1047 /tmp/0.C -o - | grep string
.string "a\243\224\227a\360K\303"
.string "\206\244\225\203"
.string "\206\244\225\203\243\211\226\225"
.string "\227\231\205\243\243\250m\206\244\225\203\243\211\226\225"
./cc1plus -quiet -fexec-charset=IBM1047 /tmp/0.C -o - | grep string
.string "a\243\224\227a\360K\303"
.string "\206\244\225\203"
.string "\206\244\225\203\243\211\226\225"
.string "const char* pretty_function()"
The following patch fixes that.
2025-10-13 Jakub Jelinek <jakub@redhat.com>
PR c++/122228
* decl.cc (cp_make_fname_decl): When not using fname_as_decl,
attempt to translate name into ordinary literal encoding.
* g++.dg/cpp1y/func_constexpr3.C: New test.
7 lines
172 B
C
7 lines
172 B
C
// PR c++/122228
|
|
// { dg-do compile { target c++11 } }
|
|
// { dg-require-iconv "IBM1047" }
|
|
// { dg-options "-fexec-charset=IBM1047 -std=c++11" }
|
|
|
|
#include "func_constexpr.C"
|