Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 31, 2015 [Issue 14062] Not pure std.variant.Variant ctor | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14062 sinkuupump@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sinkuupump@gmail.com --- Comment #1 from sinkuupump@gmail.com --- introduced by: https://github.com/D-Programming-Language/phobos/pull/2147 I'm not sure this can be fixed. opAssign(called by constructor) and destructor of Variant are changed to call the handler, and it's impure. -- |
February 01, 2015 [Issue 14062] Not pure std.variant.Variant ctor | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14062 --- Comment #2 from sinkuupump@gmail.com --- Ah, constructor can avoid calling fptr(OpId.destruct) because fpr==&handler!void there, so it can be pure. But destructor is still impure. Any ideas? -- |
March 01, 2015 [Issue 14062] Not pure std.variant.Variant ctor | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14062 --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> --- (In reply to bearophile_hugs from comment #0) > test.d(3): Error: pure function 'D main' cannot call impure function > 'std.variant.VariantN!20u.VariantN.__ctor!int.this' > test.d(3): Error: pure function 'D main' cannot call impure function > 'std.variant.VariantN!20u.VariantN.~this' > test.d(3): Error: pure function 'D main' cannot call impure function > 'std.variant.VariantN!20u.VariantN.~this' The purity violation errors had been wrongly erased by compiler issue in previous dmd versions. Currently Variant implementation does not support pure construction even if the setting value can do it. -- |
March 07, 2015 [Issue 14062] Not pure std.variant.Variant ctor | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14062 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |All OS|Windows |All Severity|regression |enhancement --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> --- (In reply to sinkuupump from comment #2) > Ah, constructor can avoid calling fptr(OpId.destruct) because fpr==&handler!void there, so it can be pure. But destructor is still impure. Any ideas? As you say, constructing Variant can be pure depending on the initialized value type, so it would be an enhancement. It is more precise test case for the enhancement: auto makeVar(int n) pure { import std.variant: Variant; return Variant(1); // constructing Variant with int could be pure } void main() { auto v = makeVar(1); } However to support it, a compile bug need to be fixed beforehand. Issue 14252 - Erroneous dtor attributes check even if the struct returned immediately On the other hand, non-algebraic Variant type cannot copy or destruct in pure function. Change the importance to 'enhancement'. -- |
December 17, 2022 [Issue 14062] Not pure std.variant.Variant ctor | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14062 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
Copyright © 1999-2021 by the D Language Foundation