https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86082

            Bug ID: 86082
           Summary: user-defined literals are not converted to the
                    execution charset
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krebbel at gcc dot gnu.org
  Target Milestone: ---

template <char... p> void q();
template <> void q<'1','2','3'>() {}

template <char... p> void operator""_test() { q<p...> (); }

int
main ()
{
  123_test;
}

builds fine with 'g++ t.cpp'
but triggers a link error compiled with 'g++ t.cpp -fexec-charset=IBM1047'

In the specialization of q the string literals '1', '2', '3' get converted to
the target character set as expected. However, the call generated in the body
of the operator does still use the source character set:

    10: 0000000000000000     2 FUNC    GLOBAL DEFAULT    2 void q<(char)-15,
(char)-14, (char)-13>()
    11: 0000000000000002    16 FUNC    GLOBAL DEFAULT    2 main
    12: 0000000000000000    12 FUNC    WEAK   DEFAULT    6 void operator""
_test<(char)49, (char)50, (char)51>()
    13: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND void q<(char)49,
(char)50, (char)51>()


When converting a user-defined literal into string literals also a conversion
into the execution charset is required.

Reply via email to