Skip to content

Commit a9427f4

Browse files
authored
Update struct.dd
1 parent 2f98da2 commit a9427f4

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

spec/struct.dd

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ void main()
835835
are generated without any implicit qualifiers and are not considered
836836
struct members. This leads to the situation where qualifying an
837837
entire struct declaration does not have any impact on the above
838-
mentioned postblits, however, since `__xpostblit` is a member of
838+
mentioned postblits. However, since `__xpostblit` is a member of
839839
the struct and an alias of one of the other postblits, the qualifiers
840840
applied to the struct will affect the aliased postblit:)
841841

@@ -846,8 +846,8 @@ struct S
846846
{ }
847847
}
848848

849-
// `__xpostblit` aliases the aggregated postblit so the `const` applies to it,
850-
// however, the aggregated postblit calls the field postblit which does not have
849+
// `__xpostblit` aliases the aggregated postblit so the `const` applies to it.
850+
// However, the aggregated postblit calls the field postblit which does not have
851851
// any qualifier applied, resulting in a qualifier mismatch error
852852
const struct B
853853
{
@@ -862,20 +862,21 @@ const struct B2
862862
S a;
863863
}
864864

865-
// ditto B
865+
// Similar to B
866866
immutable struct C
867867
{
868868
S a; // error : mutable method C.__fieldPostblit is not callable using a immutable object
869869
this(this)
870870
{ }
871871
}
872872

873+
// Similar to B2, compiles
873874
immutable struct C2
874875
{
875876
S a;
876877
}
877878

878-
// ditto B
879+
// Similar to B
879880
shared struct D
880881
{
881882
// error: non-shared method S.__postblit is not callable using a shared object
@@ -884,9 +885,16 @@ shared struct D
884885
this(this)
885886
{ }
886887
}
888+
889+
// Unlike B2, this example also does not work due to additional restrictions on shared.
890+
shared struct D2
891+
{
892+
// error: non-shared method S.__postblit is not callable using a shared object
893+
S a;
894+
}
887895
---
888896

889-
$(P In the above situations the errors do not contain any line numbers because
897+
$(P In the above situations the errors do not contain line numbers because
890898
the errors are regarding generated code. In the case of the `shared` struct,
891899
the first error message can be suppressed by qualifying the postblit of `S`
892900
with `shared`.

0 commit comments

Comments
 (0)