File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -621,7 +621,7 @@ Expression semanticTraits(TraitsExp e, Scope* sc)
621
621
}
622
622
else if (e.ident == Id.hasElaborateCopyConstructor)
623
623
{
624
- return sd.hasCopyCtor ? True() : False();
624
+ return sd.hasCopyCtor || sd.postblit ! is null ? True() : False();
625
625
}
626
626
}
627
627
return True ();
Original file line number Diff line number Diff line change @@ -112,19 +112,24 @@ void foo(T)()
112
112
static assert (__traits(hasElaborateCopyConstructor, S! int ));
113
113
}
114
114
115
- struct U (T) {
115
+ struct U (T)
116
+ {
116
117
this (ref U rhs) {}
117
118
}
118
119
119
- struct SPostblit {
120
+ struct SPostblit
121
+ {
120
122
this (this ) {}
121
123
}
122
124
125
+ struct NoCpCtor { }
126
+
123
127
static assert (__traits(hasElaborateCopyConstructor, S));
124
128
static assert (__traits(hasElaborateCopyConstructor, OuterS.S));
125
129
static assert (__traits(compiles, foo! int ));
126
130
static assert (__traits(compiles, foo! S));
127
131
static assert (__traits(hasElaborateCopyConstructor, U! int ));
128
132
static assert (__traits(hasElaborateCopyConstructor, U! S));
133
+ static assert (__traits(hasElaborateCopyConstructor, SPostblit));
129
134
130
- static assert (! __traits(hasElaborateCopyConstructor, SPostblit ));
135
+ static assert (! __traits(hasElaborateCopyConstructor, NoCpCtor ));
You can’t perform that action at this time.
0 commit comments