Testcase: ``` void foo(T...)(auto ref T args) {} void main() { import std.typecons; enum tup = tuple(1,"jojo"); foo(tup.expand); // line 6 } ``` This errors with DMD >= 2.087 with: onlineapp.d(6): Error: cannot modify constant expression `Tuple(1, "jojo").__expand_field_0`
Digger: commit e268d8301979b2f1f83b4565a20ef1387ba34396 Author: The Dlang Bot <code+dlang-bot@dawg.eu> Date: Sun Jul 7 10:14:29 2019 +0200 dmd: Merge pull request #10115 from Basile-z/issue-20011-17828 https://github.com/dlang/dmd/pull/10115 fix issue 20011, 17828 - crash or accept write operation on members of manifest constant structs merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>
Reduced example: void foo(T...)(auto ref T args) {} void main() { enum tup = Tuple(); foo(tup.expand); // line 6 } struct Tuple { int expand; } foo should probably infer non-ref for enums.
@kinke updated dlang/dmd pull request #10124 "Fix Issue 19754 - Re-apply #9505 and fix it, making isLvalue() logic more restrictive wrt. literals" fixing this issue: - Fix Issue 20608 - Revert (obsolete and problematic) #10115 Which just patched over some cracks wrt. accessing fields of struct literals. Not a full revert, as the (useful) test cases are kept. https://github.com/dlang/dmd/pull/10124
dlang/dmd pull request #10124 "Fix Issue 19754 - Re-apply #9505 and fix it, making isLvalue() logic more restrictive wrt. literals" was merged into master: - eddb064ba44d2aeed527396184b40ea37169e80d by Martin Kinkelin: Fix Issue 20608 - Revert (obsolete and problematic) #10115 Which just patched over some cracks wrt. accessing fields of struct literals. Not a full revert, as the (useful) test cases are kept. https://github.com/dlang/dmd/pull/10124