[Issue 19211] New: [REG 2.072] cant get the type of a non-const delegate in a const function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 2 04:41:12 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19211
Issue ID: 19211
Summary: [REG 2.072] cant get the type of a non-const delegate
in a const function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic, rejects-valid
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
This used to be possible:
struct Foo
{
void func1(){}
void func2() const
{alias Fun = typeof(&func1);}
}
until FE 2.072 but now produces the following error message:
> Error: mutable method `Foo.func1` is not callable using a `const` `this`
What's sure:
- this should work always inside `typeof()` since the intention is not to use
the delegate.
- the error message is wrong for the same reason.
What's less sure:
- should `&func1` always working as long as not called ?
For now the following workaround has to be used:
alias Fun = typeof(&(cast()this).func1);
--
More information about the Digitalmars-d-bugs
mailing list