source: tests/enum_tests/voidEnum.cfa @ 12df6fe

ADTast-experimentalpthread-emulationqualifiedEnum
Last change on this file since 12df6fe was 12df6fe, checked in by JiadaL <j82liang@…>, 19 months ago

Fix an enumerator value bug; add basic tests for new features; save the current progress before merge

  • Property mode set to 100644
File size: 528 bytes
Line 
1#include <fstream.hfa>
2
3enum() voidEnum {
4    a, b, c
5    /***
6    * ,d = 10 // Disable;
7    * //error: Enumerator of enum(void) cannot have an explicit initial value.
8    */
9};
10
11// void foo (const enum voidEnum & t){}
12
13int main() {
14    enum voidEnum v_1 = a;
15    enum voidEnum v_2 = b;
16    // foo(b);
17    // enum voidEnum v_3 = 10;
18    // Error as int cannot convert to void enum
19    if ( v_1 == v_2 ) {
20        sout | "Equal" | nl;
21    } else {
22        sout | "Not Equal" | nl;
23    }
24    sout | a | nl;
25    sout | b | nl;
26}
Note: See TracBrowser for help on using the repository browser.