declaration of inner function is already defined

Andrey saasecondbox at yandex.ru
Wed May 13 12:45:06 UTC 2020


Hi,

Why this works:
> void setBases(string type)(ref int data, string base, string[] 
> syllables)
> {
> 
> }
> 
> void setBases(string type, T)(ref int data, const ref T source)
> {
> 
> }
> 
> void main()
> {
>     int q = 6;
>     setBases!"tt"(q, "qwerty", ["tg", "jj"]);
>     setBases!"tt"(q, q);
> }

and this doesn't work:
> void main()
> {
>     void setBases(string type)(ref int data, string base, 
> string[] syllables)
>     {
> 
>     }
> 
>     void setBases(string type, T)(ref int data, const ref T 
> source)
>     {
> 
>     }
> 
>     int q = 6;
>     setBases!"tt"(q, "qwerty", ["tg", "jj"]);
>     setBases!"tt"(q, q);
> }

The error is:
> declaration setBases(string type, T)(ref int data, ref const T 
> source) is already defined

?


More information about the Digitalmars-d-learn mailing list