|
Last change
on this file since 2d743bd was 8705a11, checked in by Andrew Beach <ajbeach@…>, 8 months ago |
|
Added a test to check enumerations based on trac#46, which has been solved for a while, so that it may be closed.
|
-
Property mode
set to
100644
|
|
File size:
366 bytes
|
| Line | |
|---|
| 1 | // Check that the value catagory (lvalue or not) is correct.
|
|---|
| 2 |
|
|---|
| 3 | enum EnumC {
|
|---|
| 4 | C,
|
|---|
| 5 | };
|
|---|
| 6 |
|
|---|
| 7 | enum() EnumOpaque {
|
|---|
| 8 | O,
|
|---|
| 9 | };
|
|---|
| 10 |
|
|---|
| 11 | enum(int) EnumTyped {
|
|---|
| 12 | T = -7,
|
|---|
| 13 | };
|
|---|
| 14 |
|
|---|
| 15 | int main() {
|
|---|
| 16 | // Enumeration labels are like literals and are rvalues.
|
|---|
| 17 | &C;
|
|---|
| 18 | &O;
|
|---|
| 19 | &T;
|
|---|
| 20 |
|
|---|
| 21 | // Variables of enumerations are just regular variables though.
|
|---|
| 22 | EnumC c = C;
|
|---|
| 23 | &c;
|
|---|
| 24 | EnumOpaque o = O;
|
|---|
| 25 | &o;
|
|---|
| 26 | EnumTyped t = T;
|
|---|
| 27 | &t;
|
|---|
| 28 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.