Alias example should supposedly be illegal, but runs fine
codephantom
me at noyb.com
Tue Dec 19 02:04:34 UTC 2017
On Tuesday, 19 December 2017 at 01:30:07 UTC, Mike Franklin wrote:
>
> writeln(S.j);
> // Error: Instance symbols cannot be used through types.
I don't understand why you would say that is a bug.
i.e.
// ------------
import std.stdio;
struct S
{
int j;
}
void main()
{
writeln(typeof(S.j).stringof);
// prints: int
}
// -------------
"AliasDeclarations create a symbol that is an alias for another
type, and can be used anywhere that other type may appear. ".
Since typeof S.j is an int, that seems consistent with this
requirement, that alias is an alias for another type.
More information about the Digitalmars-d-learn
mailing list