[Bug c++/110343] [C++26] P2558R2 - Add @, $, and ` to the basic character set

2024-01-09 Thread emsr at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343

--- Comment #2 from Ed Smith-Rowland  ---
The example in the paper:
--
/*
gcc -E charset.c > charhelp.c
gcc -o charhelp charhelp.c
*/

#include 

#define STR(x) #x

int main()
{
  printf("%s", STR(\u0060)); // U+0060 is ` GRAVE ACCENT
  printf("%s", "\u0060"); // U+0060 is ` GRAVE ACCENT
}
--
Does give an error, but when I preprocess the file with -E the result
compiles just fine with either C or C++.

Preprocessor bug?

[Bug c++/110343] [C++26] P2558R2 - Add @, $, and ` to the basic character set

2024-01-09 Thread emsr at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343

--- Comment #3 from Ed Smith-Rowland  ---
Created attachment 57018
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57018&action=edit
Get the raw string literal to compile.

I just added the new characters to lex_raw_string and got

const char *p = R"abc`@$(foobar)abc`@$";

to go.

[Bug c++/110343] [C++26] P2558R2 - Add @, $, and ` to the basic character set

2024-01-09 Thread emsr at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343

--- Comment #5 from Ed Smith-Rowland  ---
Probably should. I'll see how to do that.
I might have to set up the lang flag and all that unless someone beats me to
it.

I was going to say that the error on the stringification is possibly correct.
The paper says usage in things _other_ than literals is illegal.

Plus, over on gcc I think they have the equivalent thing implemented and I
assume they would know.

[Bug c++/110343] [C++26] P2558R2 - Add @, $, and ` to the basic character set

2024-01-09 Thread emsr at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343

--- Comment #6 from Ed Smith-Rowland  ---
Created attachment 57019
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57019&action=edit
Add a flag to only allow new chars in c++26.

Here s a patch that adds and checks a flag in libcpp and also adds a test.

If you have a better idea for the flag name let me know.

[Bug c++/110343] [C++26] P2558R2 - Add @, $, and ` to the basic character set

2024-07-18 Thread emsr at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343

--- Comment #10 from Ed Smith-Rowland  ---
Sorry I was out for a while.
I was trying to figure out if there was some table of allowed characters we
should use. Also, C23 needs this too IIUC and I was wondering if we should
coordinate.

It looks like you got it though.