Allowed copying of tagged unions containing unit values
This commit is contained in:
parent
30de5843ba
commit
c42c9a4e57
|
@ -39,6 +39,7 @@ align(commonAlignment!(UnionKindTypes!(UnionFieldEnum!U))) struct TaggedUnion
|
|||
{
|
||||
import std.traits : FieldTypeTuple, FieldNameTuple, Largest,
|
||||
hasElaborateCopyConstructor, hasElaborateDestructor, isCopyable;
|
||||
import std.meta : templateOr;
|
||||
import std.ascii : toUpper;
|
||||
|
||||
alias FieldDefinitionType = U;
|
||||
|
@ -104,7 +105,7 @@ align(commonAlignment!(UnionKindTypes!(UnionFieldEnum!U))) struct TaggedUnion
|
|||
}
|
||||
|
||||
// postblit constructor
|
||||
static if (!allSatisfy!(isCopyable, FieldTypes)) {
|
||||
static if (!allSatisfy!(templateOr!(isCopyable, isUnitType), FieldTypes)) {
|
||||
@disable this(this);
|
||||
} else static if (anySatisfy!(hasElaborateCopyConstructor, FieldTypes)) {
|
||||
this(this)
|
||||
|
|
Loading…
Reference in a new issue