| |
| Posted by Puneet Goel in reply to Ali Çehreli | PermalinkReply |
|
Puneet Goel
Posted in reply to Ali Çehreli
| On Thursday, 22 June 2023 at 09:19:39 UTC, Ali Çehreli wrote:
> On 6/22/23 00:49, Puneet Goel wrote:
> Foo!q{foo}cc;
[...]
// p.c // q{foo}c is taken as a string
In case it's not clear to all: q{foo}c is the equivalent of "foo"c, which means a string consisting of chars (as usual).
I think it is a bug (or maybe I should call it unexpected compiler behavior) at a more fundamental level. Consider how both clang and gcc treat literal suffix errors differently compared to Dlang:
$ cat /tmp/test.d
ulong test = 44LUNG;
$ ldc2 /tmp/test.d
/tmp/test.d(1): Error: semicolon expected following auto declaration, not `NG`
/tmp/test.d(1): Error: no identifier for declarator `NG`
$ cat /tmp/test.c
int long unsigned test = 44LUNG;
$ gcc /tmp/test.c
/tmp/test.c:1:26: error: invalid suffix "LUNG" on integer constant
1 | int long unsigned test = 44LUNG;
| ^~~~~~
$ clang /tmp/test.c
/tmp/test.c:1:28: error: invalid suffix 'LUNG' on integer constant
int long unsigned test = 44LUNG;
^
1 error generated.
|