When compiling the test with `gcc -std=c11 -fsyntax-only`
compilable/testcstuff1.c:213:16: warning: character constant too long for its type
213 | _Static_assert(u'ab' == 0x610062, "ok");
| ^~~~~
compilable/testcstuff1.c:213:1: error: static assertion failed: "ok"
213 | _Static_assert(u'ab' == 0x610062, "ok");
| ^~~~~~~~~~~~~~
Test case:
```
_Static_assert(u'ab' == 0x610062, "ok");
```
Comment #1 by bugzilla — 2023-12-02T02:35:08Z
It's a warning, as most C compilers will allow multi-character character constants as an extension.
Comment #2 by ibuclaw — 2023-12-02T12:19:03Z
(In reply to Walter Bright from comment #1)
> It's a warning, as most C compilers will allow multi-character character
> constants as an extension.
The static assert fails though, which it doesn't with importC. It might suggest we're following a subtly different semantic than what C does, which may or may not be problematic in real-life projects.
Comment #3 by bugzilla — 2023-12-03T07:09:45Z
C11 6.4.4.4-11 says:
"a wide character constant prefixed by the letter u or U has type char16_t or char32_t, respectively, unsigned integer types defined in the
<uchar.h> header."
clang gives an error for u'ab', gcc gives a warning and produces the value 0x62 for it. I suggest the best solution for ImportC is to produce the value 0x62, not 0x610062.