Showing with 14 additions and 3 deletions.
  1. +7 −0 src/struct.c
  2. +7 −3 src/typinf.c
7 changes: 7 additions & 0 deletions src/struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ void StructDeclaration::semantic(Scope *sc)

id = Id::cmp;
}

{
Dsymbol *fopequals = search_function(this, Id::eq);
Dsymbol *fopcmp = search_function(this, Id::cmp);
if (fopcmp && (!fopequals))
deprecation(loc, "has `opCmp` without matching `opEquals`");
}
#endif
#if DMDV2
dtor = buildDtor(sc2);
Expand Down
10 changes: 7 additions & 3 deletions src/typinf.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,19 @@ void TypeInfoStructDeclaration::toDt(dt_t **pdt)
for (int i = 0; i < 2; i++)
{
if (fdx)
{ fd = fdx->overloadExactMatch(tfeqptr);
{
fd = fdx->overloadExactMatch(tfeqptr);
if (fd)
dtxoff(pdt, fd->toSymbol(), 0);
else
//fdx->error("must be declared as extern (D) int %s(%s*)", fdx->toChars(), sd->toChars());
{
fdx->deprecation(loc, "must be declared as `extern (D) int %s(%s)` "
"or it will be ignored by TypeInfo",
fdx->toChars(), sd->toChars());
dtsize_t(pdt, 0);
}
}
else
//fdx->error("must be declared as extern (D) int %s(%s*)", fdx->toChars(), sd->toChars());
dtsize_t(pdt, 0);

s = search_function(sd, Id::cmp);
Expand Down