This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello all.
This patch tries to implement the C++0x featue "Forward declarations for enums" aka "opaque enum declarations": http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf
Please note that this is a WIP, and as such lacks formatting, comments, testcases, etc.
Except for the things noted below, I think it works pretty well.
TODOs 1 A enum declaration should fail if adds a list of constants and it already have one. I check it with "TYPE_VALUES (type)", but this is incorrect because an empty list will not be seen. So, the current patch will accept incorrect code like: enum class Foo { }; enum class Foo { A, B, C}; I think that a new flag is needed for ENUMERAL_TYPE, but I don't know which one.
2 I am calling "finish_enum" several types, for each of the opaque declarations until it gets a list of constants. It doesn't seem to cause problems except with the debug information. With default flags and everything, gdb sees only the first declaration: enum class Foo; enum class Foo {A, B, C} Foo f;
(gdb) ptype f; enum Foo {}
I don't see an easy way to solve it...
3 I don't like very much the added parameter to the "start_enum" function, but I don't see how to do it without breaking existing code.
Comments are most welcomed.
Regards.
Rodrigo
Attachment:
enumdecl.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |