public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104640] New: incomplete unicode support for User-defined literals
@ 2022-02-22 14:15 maik.urbannek at cattatech dot de
2022-02-24 0:32 ` [Bug preprocessor/104640] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: maik.urbannek at cattatech dot de @ 2022-02-22 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104640
Bug ID: 104640
Summary: incomplete unicode support for User-defined literals
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: maik.urbannek at cattatech dot de
Target Milestone: ---
```
int operator""_π(const unsigned long long i){return (static_cast<int>(i));}
template <char...> double operator "" _π(){return 12.0;}
int main() {
const double d=0.0_π;
return 234_π+static_cast<int>(d);
}
```
In my opinion this should work (clang compiles it).
gcc produces the following error:
```
error: expected initializer before '\U000003c0'
1 | int operator""_π(const unsigned long long i){return
(static_cast<int>(i));}
| ^
Compiler returned: 1
```
Gcc(since gcc10) can compile the second operator (line 3), but not the first
(line 1).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/104640] incomplete unicode support for User-defined literals
2022-02-22 14:15 [Bug c++/104640] New: incomplete unicode support for User-defined literals maik.urbannek at cattatech dot de
@ 2022-02-24 0:32 ` pinskia at gcc dot gnu.org
2022-04-26 15:41 ` pacoarjonilla at yahoo dot es
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-24 0:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104640
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-02-24
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/104640] incomplete unicode support for User-defined literals
2022-02-22 14:15 [Bug c++/104640] New: incomplete unicode support for User-defined literals maik.urbannek at cattatech dot de
2022-02-24 0:32 ` [Bug preprocessor/104640] " pinskia at gcc dot gnu.org
@ 2022-04-26 15:41 ` pacoarjonilla at yahoo dot es
2022-04-27 2:12 ` pacoarjonilla at yahoo dot es
2022-06-10 19:13 ` lhyatt at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pacoarjonilla at yahoo dot es @ 2022-04-26 15:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104640
Paco Arjonilla <pacoarjonilla at yahoo dot es> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pacoarjonilla at yahoo dot es
--- Comment #2 from Paco Arjonilla <pacoarjonilla at yahoo dot es> ---
Here is another test case with macros.
```
#define MACRO(suffix) \
double operator "" _##suffix (long double arg) \
{ return arg; }\
double operator ""_##suffix (long long unsigned arg) \
{ return arg; }
MACRO(km)
MACRO(m)
MACRO(mm)
MACRO(µm) // <-- COMPILATION ERROR (should compile)
```
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/104640] incomplete unicode support for User-defined literals
2022-02-22 14:15 [Bug c++/104640] New: incomplete unicode support for User-defined literals maik.urbannek at cattatech dot de
2022-02-24 0:32 ` [Bug preprocessor/104640] " pinskia at gcc dot gnu.org
2022-04-26 15:41 ` pacoarjonilla at yahoo dot es
@ 2022-04-27 2:12 ` pacoarjonilla at yahoo dot es
2022-06-10 19:13 ` lhyatt at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pacoarjonilla at yahoo dot es @ 2022-04-27 2:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104640
--- Comment #3 from Paco Arjonilla <pacoarjonilla at yahoo dot es> ---
(In reply to Paco Arjonilla from comment #2)
Compiler output:
<source>:4:17: error: pasting """_" and "\U000000b5m" does not give a valid
preprocessing token
4 | double operator ""_##suffix (long long unsigned arg) \
| ^~~
<source>:11:1: note: in expansion of macro 'MACRO'
11 | MACRO(µm) // <-- COMPILATION ERROR (should compile)
| ^~~~~
<source>:11:7: error: expected initializer before '\U000000b5m'
11 | MACRO(µm) // <-- COMPILATION ERROR (should compile)
| ^~
<source>:4:22: note: in definition of macro 'MACRO'
4 | double operator ""_##suffix (long long unsigned arg) \
| ^~~~~~
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/104640] incomplete unicode support for User-defined literals
2022-02-22 14:15 [Bug c++/104640] New: incomplete unicode support for User-defined literals maik.urbannek at cattatech dot de
` (2 preceding siblings ...)
2022-04-27 2:12 ` pacoarjonilla at yahoo dot es
@ 2022-06-10 19:13 ` lhyatt at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2022-06-10 19:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104640
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |lhyatt at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #4 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Dup of PR103902. I'll take a look.
*** This bug has been marked as a duplicate of bug 103902 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-10 19:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 14:15 [Bug c++/104640] New: incomplete unicode support for User-defined literals maik.urbannek at cattatech dot de
2022-02-24 0:32 ` [Bug preprocessor/104640] " pinskia at gcc dot gnu.org
2022-04-26 15:41 ` pacoarjonilla at yahoo dot es
2022-04-27 2:12 ` pacoarjonilla at yahoo dot es
2022-06-10 19:13 ` lhyatt at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).