Skip to content

UTF-16 character literals get illegally formatted #945

@tepperly

Description

@tepperly

Here is the original code:

$ cat /tmp/foo.cpp
#include <string>

int main(int argc, char **argv) {
  char16_t c = u'\u007f';
}
$

After running uncrustify uncrustify 0.64_d, I get the following:

$ cat /tmp/newfoo.cpp
#include <string>

int main(int argc, char **argv) {
  char16_t c = u '\u007f';
}
$

The space inserted between the u and the first single quote makes the character literal unpareable.

$ g++ -std=gnu++11 -o /tmp/newfoo.o -c /tmp/newfoo.cpp
/tmp/newfoo.cpp: In function 'int main(int, char**)':
/tmp/newfoo.cpp:4:16: error: 'u' was not declared in this scope
   char16_t c = u '\u007f';
             ^
$

Here is the debug file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions