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 using 😃
to work even with -finput-charset=UTF-8
with GCC 8.2 on https://gcc.godbolt.org though (You may want to follow this bug report, provided by @DanielWolf).
Meanwhile both pieces of code work on clang 3.3 without any options other than -std=c++11
.