Bug 17129 – class-nested alias of free function can't be called from const-methods

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-01-30T14:16:38Z
Last change time
2024-12-13T18:51:26Z
Assigned to
No Owner
Creator
Marenz
Moved to GitHub: dmd#19229 →

Comments

Comment #0 by dlang — 2017-01-30T14:16:38Z
The following code fails with this compiler message: main.d(11): Error: template main.C.filter!((a) => a != 0).filter cannot deduce function from argument types !()(int[]) const, candidates are: /usr/include/dmd/phobos/std/algorithm/iteration.d(1057): main.C.filter!((a) => a != 0).filter(Range)(Range range) if (isInputRange!(Unqual!Range)) import std.algorithm; alias filterZeros2 = filter!(a=>a!=0); class C { alias filterZeros = filter!(a=>a!=0); void doCount ( ) const { filterZeros([1,2,3]).count; // fails filterZeros2([1,2,3]).count; // works } void doCount ( ) { filterZeros([1,2,3]).count; // works filterZeros2([1,2,3]).count; // works } } void main() {}
Comment #1 by robert.schadek — 2024-12-13T18:51:26Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19229 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB