Last change
on this file since 917e1fd was
12df6fe,
checked in by JiadaL <j82liang@…>, 2 years 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 | |
---|
3 | enum() 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 | |
---|
13 | int 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.