digitalmars.D.bugs - [Issue 17773] New: this template parameter not working from derived
- via Digitalmars-d-bugs (52/52) Aug 22 2017 https://issues.dlang.org/show_bug.cgi?id=17773
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 puremagic.com Reporter: code 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. --
Aug 22 2017