Package: gdc
Version: 4:9.2.1-3.1
Severity: normal

Dear Maintainer,

According to language spec:

https://dlang.org/spec/function.html#main

"""
19.20 main() Function

For console programs, main() serves as the entry point. It gets called
after all the module initializers are run, and after any unittests are
run. After it returns, all the module destructors are run. main() must be
declared using one of the following forms:

void main() { ... }
void main(string[] args) { ... }
int main() { ... }
int main(string[] args) { ... }
"""


However:
$ cat dlang.d
void main() {
}
$ gdc -flto dlang.d
/usr/lib/gcc/x86_64-linux-gnu/9/include/d/__entrypoint.di:33:5: warning: type 
of ‘_Dmain’ does not match original declaration [-Wlto-type-mismatch]
   33 | int _Dmain(char[][] args);
      |     ^
dlang.d:2:6: note: type mismatch in parameter 1
    2 | void main() {
      |      ^
dlang.d:2:6: note: type ‘void’ should match type ‘struct char[][]’
dlang.d:2:6: note: ‘D main’ was previously declared here
$

It does compile fine using `int mine(string[] args)` (and returning 0
from it) and run correctly.

Also the message 'void' should match type 'struct char[][]' is confusing.
'struct'? void (return type?) should match it. Weird wording. I guess,
maybe it is parameter 1, which is not in my definition, but should be
string[]. But I am guessing here. Wording is weird and unclear what is
what.

Minor issue, but still a bit annoying and a violatation of the D language
spec.


Regards,
Witold




-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-3-amd64 (SMP w/32 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gdc depends on:
ii  gdc-9           9.3.0-11
ii  libgphobos-dev  9.2.1-3.1

gdc recommends no packages.

gdc suggests no packages.

-- no debconf information

Reply via email to