[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/ntrel/cppfront/type-is/regression-tests/pure2-enum.cpp2 [Back]  [Original]

skat_game: @enum type = {
    diamonds := 9;
    hearts;  // 10
    spades;  // 11
    clubs;   // 12
    grand    := 20;
    null     := 23;
}

janus: @enum type = {
    past;
    future;

    flip: (inout this) == {
        if this == past { this = future; }
        else { this = past; }
    }
}

file_attributes: @flag_enum type = {
    cached;     // 1
    current;    // 2
    obsolete;   // 4
    cached_and_current := cached | current;
}

main: () = {
    j := janus::past;
    j.flip();
    _ = j;

    // x : skat_game = 9;               // error, can't construct skat_game from integer

    x: skat_game = skat_game::clubs;
    x2 := skat_game::diamonds;
    x2 = x;

    // if x == 9 { }                    // error, can't compare skat_game and integer
    // if x == rgb::red { }             // error, can't compare skat_game and rgb color

    std::cout 

Web Proxy Viewer  |  New URL  |  Original Page