[Issue 6557] Inplace enum literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 26 05:14:02 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6557



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2011-08-26 05:14:00 PDT ---
> void foo(enum {a, b} arg) {
>     if (arg == b) {}
>     if (arg == foo.a) {} // alternative syntax
> }

I have one question.
In following case, what does foo receive as arg?

void main()
{
    typeof(foo.a) E;
    E a = foo.b;
    foo(a);   // == foo(foo.a) or foo(foo.b) ?
}

I think the enum scope inference from their member name is nearly impossible,
because D has template function.
The feature requires a function signature to determine the argument types, but
template function call requires argument types to determine the function
signature!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list