bugGNU gettext - Bugs: bug #50117, bogus "unterminated character...


You are not allowed to post comments on this tracker with your current authentication level.

bug #50117: bogus "unterminated character constant" warning with C++14 single-quotation-mark as digit separators

Submitted by:  Moritz Bunkus <mbunkus>
Submitted on:  Sun 22 Jan 2017 11:03:34 AM UTC  
Category:  C Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Bruno Haible <haible>
Open/Closed:  Closed

( Jump to the original submission)

Fri 10 May 2019 01:16:49 AM UTC, comment #7: 

Thanks Bruno.

Kip <kip>
Thu 09 May 2019 07:26:58 PM UTC, comment #6: 

The fix is contained in the gettext-0.20 release.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Fri 12 Apr 2019 07:48:39 AM UTC, comment #5: 

Thanks Bruno. That looks pretty bleeding edge. It's not in my distro's current release (cosmic), nor does it appear as though I can anticipate it being in the subsequent release (disco). Fortunately the warnings are likely only a minor innocuous nuisance.

Kip <kip>
Thu 11 Apr 2019 09:09:36 AM UTC, comment #4: 

The xgettext binary that you are using does not include the fix.

> $ xgettext --version
> xgettext (GNU gettext-tools)

It works with
$ xgettext --version
xgettext (GNU gettext-tools)
or newer.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Thu 11 Apr 2019 02:15:10 AM UTC, comment #3: 

Bruno, it looks like either I'm not using xgettext(1) correctly, or your patch may not have solved the problem:

$ cat minimal.cpp
int main() {
auto i = 1'234;
return 0;

$ xgettext --version
xgettext (GNU gettext-tools)
Copyright (C) 1995-1998, 2000-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Ulrich Drepper.

$ xgettext minimal.cpp
minimal.cpp:2: warning: unterminated character constant

Kip <kip>
Sat 06 Jan 2018 05:52:21 PM UTC, comment #2: 

Thanks for the report. Fixed through http://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=6d86e6f80d60c414888ba54eb313f897776cecf1

I could not use your patch, because the code was hard to understand (two additional booleans in a loop) and not standards-compliant (no support for the '_' character in preprocessing number tokens).

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Fri 28 Jul 2017 01:45:48 AM UTC, comment #1: 

I've created a patch to support this, and tested it on MAME, which makes fairly heavy use of C++14 digit grouping.  I'm attaching it as a git changeset.

(file #41365)

Vas Crabb <cuavas>
Sun 22 Jan 2017 11:03:34 AM UTC, original submission:  

xgettext doesn't support C++14's "Single-quotation-mark as a digit separator" feature[1] properly. It'll issue a warning about an "unterminated character constant" with the following trivial program:

int main() {
  auto i = 1'234;
  return 0;

Invoke xgettext:

[0 mosu@sweet-chili ~/test] xgettext -o test.pot test2.cpp
test2.cpp:2: warning: unterminated character constant

If you want to verify that this is an actually valid C++14 program:

[0 mosu@sweet-chili ~/test] g++ -std=c++14 -o test2 test2.cpp
[0 mosu@sweet-chili ~/test]

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf

Moritz Bunkus <mbunkus>


Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by kip (Posted a comment)
  • -email is unavailable- added by kip
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by cuavas (Updated the item)
  • -email is unavailable- added by mbunkus (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-11 kip Carbon-Copy- => Added kip@thevertigo.com
    2018-01-06 haible StatusNone => Fixed
        Assigned toNone => haible
        Open/ClosedOpen => Closed
    2017-07-28 cuavas Attached File- => Added 0001-Recognise-C-14-digit-grouping-with-character.patch, #41365

    Back to the top

    Powered by Savane 3.6