[Issue 23999] literal suffixes dont mix well with template instantiations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 22 10:07:44 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23999

--- Comment #10 from Puneet Goel <puneet at coverify.org> ---
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.

--


More information about the Digitalmars-d-bugs mailing list