[Issue 17773] New: this template parameter not working from derived class
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Aug 22 09:38:21 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17773
Issue ID: 17773
Summary: this template parameter not working from derived class
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
class Base
{
this(size_t size)
{
}
size_t classSize(this This)()
{
pragma(msg, This);
return This.sizeof;
}
}
class Derived : Base
{
this()
{
super(classSize);
}
void foo()
{
classSize;
}
}
void test()
{
auto derived = new Derived;
auto size = derived.classSize;
}
CODE
dmd -c bug
----
bug.d(18): Error: constructor bug.Base.this (ulong size) is not callable using
argument types (void)
bug.d(23): Error: template classSize(this This)() has no type
Derived
----
Seems like template this parameters are not correctly resolved/inferred when
calling such methods from a derived instance.
--
More information about the Digitalmars-d-bugs
mailing list