Bug 20896 – this.__lambda2 has no value when trying to evaluate length of AliasSeq

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-05T08:43:05Z
Last change time
2024-12-13T19:09:00Z
Assigned to
No Owner
Creator
Simen Kjaeraas
Moved to GitHub: dmd#17960 →

Comments

Comment #0 by simen.kjaras — 2020-06-05T08:43:05Z
Just referring to a template parameter list containing a lambda can cause a compile error: struct S { int i = bug!(a => "b"); } auto bug(fns...)() { return fns.length; // this.__lambda2 has no value } Moving the assignment outside of S makes the error go away, so it might be DMD wants it to have a context pointer, which is unnecessary in this case.
Comment #1 by moonlightsentinel — 2020-06-05T12:39:31Z
This is actually a regression and worked in 2.061. Digger: commit 186d9f9e85d3a092b575dc657ac55bc29604b77d Author: Walter Bright <[email protected]> Date: Wed Mar 6 23:55:11 2013 -0800 dmd: Merge pull request #1722 from 9rnsr/fix9633 https://github.com/dlang/dmd/pull/1722 [REG2.063a] Issue 9633 - compiles trait wrongly returns true even when object method call actually does not compile
Comment #2 by robert.schadek — 2024-12-13T19:09:00Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17960 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB