Comment #0 by shammah.chancellor — 2015-03-28T16:53:11Z
```
> dmd test0158.d
test0158.d(7): Error: basic type expected, not 42
test0158.d(7): Error: semicolon expected to close alias declaration
test0158.d(7): Error: declaration expected, not '42'
```
```test0158.d
//T compiles:yes
//T has-passed:yes
//T retval:42
// alias of type and values
alias b = a;
alias c = 42;
alias d = c;
alias e = b;
b main() {
a b = c;
e f = b;
return f;
}
alias a = uint;
```
Comment #2 by shammah.chancellor — 2015-03-28T17:52:26Z
Seems like an arbitrary restriction. Any reason for that? I will file an issue against SDC.
Comment #3 by ketmar — 2015-03-28T18:10:08Z
dunno, i can't see any reason to duplicate `enum` with `alias`.
`alias` meant for aliasing *identifiers*, not literals. i.e.
enum a = 42;
alias b = a;
is working.
Comment #4 by deadalnix — 2015-03-29T05:43:59Z
alias foo = int;
Is int an identifier now ?
Comment #5 by ketmar — 2015-03-29T05:49:18Z
and it always was. it's the indentifier which denotes type.
Comment #6 by deadalnix — 2015-03-29T05:55:37Z
(In reply to Ketmar Dark from comment #5)
> and it always was. it's the indentifier which denotes type.
Well then 3 always was as well. It is the "indentifier" which denotes value. Good to see you agree with me.
Comment #7 by ketmar — 2015-03-29T05:59:05Z
and space to. and absense of chars altogether. to be honest, everything is just a "0" or "1". so i wonder why you are using such unnecessary complex things as high-level languages instead of entering binary codes with switches, as real men do.
Comment #8 by yebblies — 2015-04-11T06:34:15Z
This is working as intended, so it's an enhancement.
Comment #9 by nick — 2022-10-02T16:27:49Z
Template alias parameters can accept literal values, so it is inconsistent that alias declarations cannot. It is also awkward for generic code, hence the std.meta.Alias template. Making alias consistent would help with language simplification & learning.
Comment #10 by robert.schadek — 2024-12-13T18:41:35Z