add __rvalue(expression) builtin (#17050)

This commit is contained in:
Walter Bright 2024-12-15 12:13:28 -08:00 committed by GitHub
parent 13775eb2d1
commit a99a3894be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 471 additions and 163 deletions

View file

@ -1,20 +0,0 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail19871.d(10): Error: `struct Struct` may not define both a rvalue constructor and a copy constructor
fail_compilation/fail19871.d(19): rvalue constructor defined here
fail_compilation/fail19871.d(13): copy constructor defined here
---
*/
struct Struct
{
@disable this();
this(ref Struct other)
{
const Struct s = void;
this(s);
}
this(Struct) {}
}

View file

@ -1,15 +0,0 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail19931.d(10): Error: `struct S` may not define both a rvalue constructor and a copy constructor
fail_compilation/fail19931.d(12): rvalue constructor defined here
fail_compilation/fail19931.d(13): copy constructor defined here
---
*/
struct S
{
this(S s) {}
this(ref S s) {}
this(this) {}
}

View file

@ -1,22 +0,0 @@
// https://issues.dlang.org/show_bug.cgi?id=23036
/*
TEST_OUTPUT:
---
fail_compilation/fail23036.d(12): Error: `struct S` may not define both a rvalue constructor and a copy constructor
fail_compilation/fail23036.d(15): rvalue constructor defined here
fail_compilation/fail23036.d(14): copy constructor defined here
---
*/
struct S
{
this(ref S) {}
this(S, int a = 2) {}
}
void main()
{
S a;
S b = a;
}