I have a feature request: "Named enum scope inference"
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Sep 28 20:11:20 PDT 2012
On 9/29/12, David Piepgrass <qwertie256 at gmail.com> wrote:
> I like the spirit of this feature, but as Alex pointed out,
> ambiguity is possible (which could theoretically cause errors in
> existing code)
It could also cause subtle problems because enum values are implicitly
convertible to the enum's base type. Take this for example:
void test(bool state) { }
enum Foo { no, yes }
class Class
{
enum Bar { yes, no }
void test() { .test(no); } // pass Foo.no (true) or Bar.no (false) ?
}
More information about the Digitalmars-d
mailing list