| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail15044.d(30): Error: generated function `fail15044.V.opAssign` cannot be used because it is annotated with `@disable` |
| 5 |
--- |
| 6 |
*/ |
| 7 |
|
| 8 |
struct S |
| 9 |
{ |
| 10 |
void opAssign(S) {} |
| 11 |
} |
| 12 |
|
| 13 |
struct V |
| 14 |
{ |
| 15 |
// `s` has opAssign, so struct V needs to generate member-wise opAssign. |
| 16 |
// But S.opAssign is not callable on const object, so V.opAssign should be |
| 17 |
// @disable. |
| 18 |
const S s; |
| 19 |
|
| 20 |
// Here, the initializer of x is evaluated in V.semantic2. But |
| 21 |
// V.opAssign.semantic3 is not yet invoked, so its attribute should be |
| 22 |
// lazily inferred in functionSemantic even though it's non-instantiated function. |
| 23 |
enum int x = () |
| 24 |
{ |
| 25 |
// Here, the initializer of x is evaluated in V.semantic2, and |
| 26 |
// V.opAssign.semantic3 is not yet invoked in this time. |
| 27 |
// Therefore its @disable attribute needs to be inferred by |
| 28 |
// functionSemantic, even though it's non-instantiated function. |
| 29 |
V v; |
| 30 |
v = v; |
| 31 |
}(); |
| 32 |
} |