Error: variable foo conflicts with struct foo

Colin grogan.colin at gmail.com
Thu Jan 4 17:59:55 UTC 2018


On Thursday, 4 January 2018 at 17:45:35 UTC, Stijn wrote:
> Why is it not allowed for a variable name to match a type name? 
> The following example fails with "Error: variable foo conflicts 
> with struct foo"
>
>     struct foo {}
>     foo foo;

How can the compiler know which symbol is which symbol if 
everything has the same name?

Standard practice is to capitalise type names and camelCase 
variable names.


More information about the Digitalmars-d-learn mailing list