Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 07, 2019 [Issue 11864] std.variant.Variant doesn't work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11864 Norm Rowtree <norm.rowtree@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |norm.rowtree@gmail.com --- Comment #2 from Norm Rowtree <norm.rowtree@gmail.com> --- I get pretty much the same error reported using the code snippet below and DMD D Compiler v2.084.0 struct S { Variant v = Variant(10); } void main() {auto s = S();} dmd2/linux/bin64/../../src/phobos/std/variant.d(661): Error: memcpy cannot be interpreted at compile time, because it has no available source code Error: cannot interpret <error> at compile time I don't need this evaluated at compile time, I just want a default value when the struct is instantiated at runtime. Thanks, Norm -- |
February 08, 2019 [Issue 11864] std.variant.Variant doesn't work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11864 --- Comment #3 from anonymous4 <dfj1esp02@sneakemail.com> --- Default struct value doesn't run code at runtime and there are no plans for it. You can disable default struct constructor to make non-default constructor mandatory, `S()` form is fine too if you declare static opCall. -- |
March 23, 2019 [Issue 11864] std.variant.Variant doesn't work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11864 Ali Ak <ali.akhtarzada@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ali.akhtarzada@gmail.com --- Comment #4 from Ali Ak <ali.akhtarzada@gmail.com> --- This is unfortunately a pain point in the language. The problem is that D expects a .init value for every type to be known. So currently, the (arbitrary) choice has been to not allow a default constructor because people could get confused by statements such as struct A { int i; this() { i = 4; } } A a; writeln(a.i); // prints 0 The code above, in D, needs to call A.init, which is not the same as the constructor. The only work around is the static opCall, but then you can't have any constructors, which is unfortunately not practical. D could either allow a default constructor and document the differences between initialization and construction, or lift the restriction of static opCall and other constructors in the same type. -- |
April 15, 2019 [Issue 11864] std.variant.Variant doesn't work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11864 --- Comment #5 from Norm Rowtree <norm.rowtree@gmail.com> --- Thanks, the static opCall workaround is good enough for my needs. -- |
June 13, 2020 [Issue 11864] std.variant.Variant doesn't work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11864 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |issues.dlang@jmdavisProg.co | |m --- Comment #6 from Paul Backus <snarwin+bugzilla@gmail.com> --- *** Issue 17987 has been marked as a duplicate of this issue. *** -- |
December 17, 2022 [Issue 11864] std.variant.Variant doesn't work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11864 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P4 -- |
Copyright © 1999-2021 by the D Language Foundation