[Issue 19211] get the type of a non-const delegate in a const function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 23 09:39:01 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19211
Basile-z <b2.temp at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
let's close.
one can do, instead of using &func1 which is contaminated by transitive const.
---
struct Foo
{
void func1(){}
void func2() const {alias Fun = typeof(&(new Foo).func1);}
}
---
The problem pointed by the original report is more that people don't understand
how `const` works, i.e in a `const` function, `this` becomes `const` and is
propagated by transitivity, which is even something I pointed in a blog post in
after reporting.
--
More information about the Digitalmars-d-bugs
mailing list