duplicate symbols

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 10 03:00:46 PDT 2015


It will when you try to use this function
test.d(18): Error: test.generate called with argument types (S) matches
both: test.d(7):     test.generate(S t)
and:
test.d(12):     test.generate(S t)



On Fri, 10 Apr 2015 09:54:31 +0000
Dmitri Makarov via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:

> Should the compiler issue an error for this code?
> 
> struct S
> {
> }
> 
> string generate(S t)
> {
>    return "";
> }
> 
> string generate(S t)
> {
>    return "huh?";
> }
> 
> It compiles and breaks with multiple definition of 
> '_D1b8generateFS1b1SZAya' at link time. dmd v2.067


More information about the Digitalmars-d-learn mailing list