Skip to content

Commit

Permalink
test: Remove 'ref' checks from -preview=in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw authored and dlang-bot committed Nov 6, 2023
1 parent d24a885 commit f55bc3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
6 changes: 0 additions & 6 deletions compiler/test/compilable/previewin.d
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,25 @@ version (Win64)
{
void checkReal(in real p)
{
// ref for x87 real, value for double-precision real
static assert(__traits(isRef, p) == (real.sizeof > 8));
}

struct RGB { ubyte r, g, b; }
void checkNonPowerOf2(in RGB p)
{
static assert(__traits(isRef, p));
}
}
else version (X86_64) // Posix x86_64
{
struct Empty {} // 1 dummy byte passed on the stack
void checkEmptyStruct(in Empty p)
{
static assert(!__traits(isRef, p));
}

static if (is(__vector(double[4])))
{
struct AvxVectorWrapper { __vector(double[4]) a; } // 256 bits
void checkAvxVector(in AvxVectorWrapper p)
{
static assert(!__traits(isRef, p));
}
}
}
Expand All @@ -111,6 +106,5 @@ else version (AArch64)
alias HVA = __vector(float[4])[4]; // can be passed in 4 vector registers
void checkHVA(in HVA p)
{
static assert(!__traits(isRef, p));
}
}
20 changes: 9 additions & 11 deletions compiler/test/runnable/previewin.d
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,25 @@ struct WithDtor
@safe pure nothrow @nogc:

// By value
void testin1(in uint p) { static assert(!__traits(isRef, p)); }
void testin1(in uint p) { }
// By ref because of size
void testin2(in ulong[64] p) { static assert(__traits(isRef, p)); }
void testin2(in ulong[64] p) { }
// By value or ref depending on size (or structs always passed by reference)
void testin3(in ValueT p) { static assert(!__traits(isRef, p) || true); }
void testin3(in RefT p) { static assert(__traits(isRef, p)); }
void testin3(in ValueT p) { }
void testin3(in RefT p) { }
// By ref because of size (or arrays always passed by reference)
void testin4(in ValueT[64] p) { static assert(__traits(isRef, p)); }
void testin4(in RefT[4] p) { static assert(__traits(isRef, p)); }
void testin4(in ValueT[64] p) { }
void testin4(in RefT[4] p) { }

// By ref because of non-copyability
void testin5(in NonCopyable noncopy) { static assert(__traits(isRef, noncopy)); }
static assert(testin5.mangleof == "_D9previewin7testin5FNaNbNiNfIKSQBe11NonCopyableZv"); // incl. `ref`
void testin5(in NonCopyable noncopy) { }
// By ref because of postblit
void testin6(in WithPostblit withpostblit) { static assert(__traits(isRef, withpostblit)); }
void testin6(in WithPostblit withpostblit) { }
// By ref because of copy ctor
void testin7(in WithCopyCtor withcopy) { static assert(__traits(isRef, withcopy)); }
void testin7(in WithCopyCtor withcopy) { }
// By ref because of dtor
void testin8(in WithDtor withdtor, scope bool* isTestOver)
{
static assert(__traits(isRef, withdtor));
if (isTestOver)
*isTestOver = true;
}
Expand Down

0 comments on commit f55bc3f

Please sign in to comment.