Multiple functions, same signature

rikki cattermole rikki at cattermole.co.nz
Wed Jul 11 16:02:28 UTC 2018


On 12/07/2018 3:58 AM, Luís Marques wrote:
> I was surprised to find out today that this compiles:
> 
> void foo() {}
> void foo() {}
> void main() {}
> 
> Is it a bug, or just a weird design decision? "alphaglosined" on IRC 
> seemed to think it was a regression. Please confirm, so that I can file 
> a bug, or understand the design decision rationale.

The reason I think that it is a regression is because of [0].

Either the change log didn't include some changes, environment/linker or 
its a regression IMHO.

```
Up to      2.071.2: Failure with output:
-----
onlineapp.o: In function `_D9onlineapp3fooFiZv':
/sandbox/onlineapp.d:2: multiple definition of `_D9onlineapp3fooFiZv'
onlineapp.o:onlineapp.d:(.text._D9onlineapp3fooFiZv+0x0): first defined here
collect2: error: ld returned 1 exit status
--- errorlevel 1
-----

2.072.2 to 2.074.1: Failure with output:
-----
onlineapp.o: In function `_D9onlineapp3fooFiZv':
/sandbox/onlineapp.d:2: multiple definition of `_D9onlineapp3fooFiZv'
onlineapp.o:onlineapp.d:(.text._D9onlineapp3fooFiZv+0x0): first defined here
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
-----

Since      2.075.1: Success and no output
```


[0] https://run.dlang.io/is/AGuM6P


More information about the Digitalmars-d mailing list