Cannot alias null

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 12 13:59:17 PDT 2014


On 06/12/2014 01:36 PM, Andrew Edwards wrote:

 > void foo() {}
 > alias bar = foo();
 >
 > Am I just misunderstanding what is meant by types?

Seems to be an old behavior. That does not compile with 2.066:

Error: function declaration without return type. (Note that constructors 
are always named 'this')

The following compiles though:

alias bar = foo;

I stand corrected: alias works not only with types but with symbols as 
well. I was right about the original code though: "Aliases cannot be 
used for expressions".

Ali



More information about the Digitalmars-d-learn mailing list