Skip to content

Commit 314373a

Browse files
committed
std.variant: Minor fixes
Fix constraints for clearer error messages.
1 parent 6bc3a4f commit 314373a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

std/variant.d

+5-3
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private:
130130
}
131131
enum size = SizeChecker.sizeof - (int function()).sizeof;
132132

133-
/** Tells whether a type $(D T) is statically allowed for
133+
/** Tells whether a type $(D T) is statically _allowed for
134134
* storage inside a $(D VariantN) object by looking
135135
* $(D T) up in $(D AllowedTypes).
136136
*/
@@ -721,8 +721,8 @@ public:
721721

722722
/**
723723
* Returns $(D true) if and only if the $(D VariantN)
724-
* object holds an object implicitly convertible to type $(D
725-
* U). Implicit convertibility is defined as per
724+
* object holds an object implicitly convertible to type `T`.
725+
* Implicit convertibility is defined as per
726726
* $(REF_ALTTEXT ImplicitConversionTargets, ImplicitConversionTargets, std,traits).
727727
*/
728728

@@ -843,6 +843,7 @@ public:
843843

844844
// returns 1 if the two are equal
845845
bool opEquals(T)(auto ref T rhs) const
846+
if (allowed!T || is(Unqual!T == VariantN))
846847
{
847848
static if (is(Unqual!T == VariantN))
848849
alias temp = rhs;
@@ -865,6 +866,7 @@ public:
865866
*/
866867

867868
int opCmp(T)(T rhs)
869+
if (allowed!T)
868870
{
869871
static if (is(T == VariantN))
870872
alias temp = rhs;

0 commit comments

Comments
 (0)