Cannot alias null
Andrew Edwards via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 12 13:36:45 PDT 2014
On 6/12/14, 4:29 PM, Ali Çehreli wrote:
> On 06/12/2014 01:26 PM, Tom Browder via Digitalmars-d-learn wrote:
>
> > This will not compile:
> >
> > alias blah = null;
> >
> > The dmd message are:
> >
> > di/test_hdr.d(10): Error: basic type expected, not null
> > di/test_hdr.d(10): Error: semicolon expected to close alias declaration
> > di/test_hdr.d(10): Error: Declaration expected, not 'null'
> >
> > Are there any other objects that cannot be aliased?
>
> alias works only with types. Being an expression (not an object), null
> cannot not work with alias.
>
> Ali
>
void foo() {}
alias bar = foo();
Am I just misunderstanding what is meant by types?
More information about the Digitalmars-d-learn
mailing list