[Issue 19715] New: AutoImplement `self` and `parent` aliases are incorrect for overloaded functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 3 16:59:11 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19715
Issue ID: 19715
Summary: AutoImplement `self` and `parent` aliases are
incorrect for overloaded functions
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: htvennik at gmail.com
The aliases `self` and `parent` are both declared by aliasing the function by
name. For overloaded functions this means the overloads is aliased, not the
exact function being implemented. This is not a problem when just calling
`self` or `parent`, but for reflection purposes it is.
The following should work, but doesn't:
----------
import std.typecons : AutoImplement;
interface A
{
void overloaded(int);
void overloaded(float);
}
enum tpl(C, alias fun) = q{
import std.traits : Parameters;
static assert(is(Parameters!self == typeof(args)));
};
alias Impl = AutoImplement!(A, tpl);
----------
Output:
$ dmd -o- -c autoimplement.d
/Library/D/dmd/src/phobos/std/typecons.d-mixin-4495(4510): Error: static
assert: is((int) == (float)) is false
autoimplement.d(14): instantiated from here: AutoImplement!(A, tpl,
isAbstractFunction)
--
More information about the Digitalmars-d-bugs
mailing list