mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
test: Remove 'ref' checks from -preview=in tests
This commit is contained in:
parent
d24a8859b0
commit
f55bc3f8a8
2 changed files with 9 additions and 17 deletions
|
@ -79,14 +79,11 @@ version (Win64)
|
||||||
{
|
{
|
||||||
void checkReal(in real p)
|
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; }
|
struct RGB { ubyte r, g, b; }
|
||||||
void checkNonPowerOf2(in RGB p)
|
void checkNonPowerOf2(in RGB p)
|
||||||
{
|
{
|
||||||
static assert(__traits(isRef, p));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else version (X86_64) // Posix x86_64
|
else version (X86_64) // Posix x86_64
|
||||||
|
@ -94,7 +91,6 @@ else version (X86_64) // Posix x86_64
|
||||||
struct Empty {} // 1 dummy byte passed on the stack
|
struct Empty {} // 1 dummy byte passed on the stack
|
||||||
void checkEmptyStruct(in Empty p)
|
void checkEmptyStruct(in Empty p)
|
||||||
{
|
{
|
||||||
static assert(!__traits(isRef, p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static if (is(__vector(double[4])))
|
static if (is(__vector(double[4])))
|
||||||
|
@ -102,7 +98,6 @@ else version (X86_64) // Posix x86_64
|
||||||
struct AvxVectorWrapper { __vector(double[4]) a; } // 256 bits
|
struct AvxVectorWrapper { __vector(double[4]) a; } // 256 bits
|
||||||
void checkAvxVector(in AvxVectorWrapper p)
|
void checkAvxVector(in AvxVectorWrapper p)
|
||||||
{
|
{
|
||||||
static assert(!__traits(isRef, p));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +106,5 @@ else version (AArch64)
|
||||||
alias HVA = __vector(float[4])[4]; // can be passed in 4 vector registers
|
alias HVA = __vector(float[4])[4]; // can be passed in 4 vector registers
|
||||||
void checkHVA(in HVA p)
|
void checkHVA(in HVA p)
|
||||||
{
|
{
|
||||||
static assert(!__traits(isRef, p));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,27 +154,25 @@ struct WithDtor
|
||||||
@safe pure nothrow @nogc:
|
@safe pure nothrow @nogc:
|
||||||
|
|
||||||
// By value
|
// By value
|
||||||
void testin1(in uint p) { static assert(!__traits(isRef, p)); }
|
void testin1(in uint p) { }
|
||||||
// By ref because of size
|
// 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)
|
// 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 ValueT p) { }
|
||||||
void testin3(in RefT p) { static assert(__traits(isRef, p)); }
|
void testin3(in RefT p) { }
|
||||||
// By ref because of size (or arrays always passed by reference)
|
// 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 ValueT[64] p) { }
|
||||||
void testin4(in RefT[4] p) { static assert(__traits(isRef, p)); }
|
void testin4(in RefT[4] p) { }
|
||||||
|
|
||||||
// By ref because of non-copyability
|
// By ref because of non-copyability
|
||||||
void testin5(in NonCopyable noncopy) { static assert(__traits(isRef, noncopy)); }
|
void testin5(in NonCopyable noncopy) { }
|
||||||
static assert(testin5.mangleof == "_D9previewin7testin5FNaNbNiNfIKSQBe11NonCopyableZv"); // incl. `ref`
|
|
||||||
// By ref because of postblit
|
// 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
|
// 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
|
// By ref because of dtor
|
||||||
void testin8(in WithDtor withdtor, scope bool* isTestOver)
|
void testin8(in WithDtor withdtor, scope bool* isTestOver)
|
||||||
{
|
{
|
||||||
static assert(__traits(isRef, withdtor));
|
|
||||||
if (isTestOver)
|
if (isTestOver)
|
||||||
*isTestOver = true;
|
*isTestOver = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue