enum sstring problem

Lloyd Dupont ld-REMOVE at galador.net
Sun Jun 12 17:53:41 PDT 2011


do you have DMD 2.053 on Windows?
Your code fail for me with:
====
main.d(10): Error: Integer constant expression expected instead of "hello"
main.d(11): Error: Integer constant expression expected instead of "betty"
main.d(10): Error: Integer constant expression expected instead of "hello"
main.d(11): Error: Integer constant expression expected instead of "betty"
=====

"Timon Gehr"  wrote in message news:it3k0u$15s6$1 at digitalmars.com... 

Lloyd Dupont wrote:
> I'm using 2.053
> this compile fine:
> ====
> enum : string
> {
>     A = "hello",
>     B = "betty",
> }
> ====
>
> this doesn't!
> ====
> enum AA : string
> {
>     A = "hello",
>     B = "betty",
> }
> ====
>
> Am I missing something? Named enum can't be typed? known bug?

It works just fine for me.

How I test:

import std.stdio;
enum AA : string
{
    A = "hello",
    B = "betty",
}
void main(){
    writeln(AA.A);
    writeln(AA.B);
}

Compiles and runs.

Timon


More information about the Digitalmars-d-learn mailing list