Enums - probably an old subject

John J john.joyus at gmail.com
Thu Nov 21 17:11:02 PST 2013


On 11/21/2013 01:36 PM, Steve Teale wrote:
> I thought that compilers were supposed to help you if you did ambiguous
> things. An interesting example is:
>
> int bar(int n)
> {
>     return n+1;
> }
>
> int bar(int n)
> {
>     return n+2;
> }
>
> void main()
> {
>     int v = 22;
>     int n = bar(22);
> }


Compiler helps here by throwing an error.
Those are two duplicate functions with same exact arguments.


More information about the Digitalmars-d mailing list