相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
This is a known bug in GCC: Bug 67224 - UTF-8 support for identifier names in GCC.
The bug report is from 2015 and has a rather long discussion. At some point, it mentions that "There doesn't seem to be sufficient demand for this feature so that companies fund it or volunteers step up to implement it."
So if you found this StackOverflow topic looking for a solution, you might want to add to the discussion over there to show that there is, in fact, demand.
As of 4.8, gcc does not support characters outside of the BMP used as identifiers. It seems to be an unnecessary restriction. Also, gcc only supports a very restricted set of character described in ucnid.tab, based on C99 and C++98 (it is not updated to C11 and C++11 yet, it seems).
As described in the manual,
-fextended-identifiers
is experimental, so it has a higher chance won't work as expected.Edit:
GCC supported the C11 character set starting from 4.9.0 (svn r204886 to be precise). So OP's second piece of code using
\U0001F603
does work. I still can't get the actual code usingOne thing to keep in mind is that just because the C++ standard allows (or disallows) some feature, does not necessarily mean that your compiler supports (or doesn't support) that feature.