alias syntax

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Aug 1 20:21:01 PDT 2009


On Sat, Aug 1, 2009 at 11:13 PM, Ellery
Newcomer<ellery-newcomer at utulsa.edu> wrote:

> um, yeah.
>
> Declaration:
>        typedef Decl
>        alias Decl
>        Decl
>
> Decl:
>        StorageClasses Decl
>        BasicType Declarators ;
>        BasicType Declarator FunctionBody
>        AutoDeclaration
>
>
> Never mind that's wrong.
>
> but it looks like it should be
>
> alias StorageClasses BasicType Declarator

'Decl' is recursive.  So:

alias Decl

can expand to:

alias StorageClasses Decl

which expands to:

alias StorageClasses BasicType Declarators ;

But is this not what you're pointing out?  Are you instead taking
issue with the fact that the grammar accepts something like "alias int
foo() {}" whereas the compiler doesn't?

> Looking through declaration.c, I noticed that semantic disallows
> specifically
>
> alias const {blah blah blah}
>
> but not the others.

You mean how the compiler rejects "alias const int x;" but not "alias
static int x;"?  That is strange..


More information about the Digitalmars-d-learn mailing list