[Issue 8983] Overload introduced behind mixin template can't be called from another overload
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 9 02:59:42 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8983
Maxim Fomin <maxim at maxim-fomin.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maxim at maxim-fomin.ru
--- Comment #3 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-11-09 02:59:41 PST ---
(In reply to comment #2)
> One unfortunate consequence of the nested scope rule is we cannot use unnamed
> mixins for adding definitions to declarations.
>
> mixin template Foo()
> {
> void foo() {}
> }
>
> class A
> {
> void foo();
> mixin Foo;
> }
>
> results in undefined reference.
Even if there were no nested scope, this still would not work because function
with omitted body is expected to appear in another object file:
class A
{
void foo();
void foo() {}
}
void main()
{
(new A).foo;
}
will fail because foo matches "both foo and foo". This contradicts to C
practice and does not make sense because dmd artificially creates ambiguity
between function declaration and its own body. I complained in Bugzilla but was
told that such practice in redundant in C and need not supported even as
enhancement.
--
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