@@ -549,49 +549,20 @@ Expression opOverloadBinary(BinExp e, Scope* sc, Type[2] aliasThisStop)
549
549
AggregateDeclaration ad1 = isAggregate(e.e1.type);
550
550
AggregateDeclaration ad2 = isAggregate(e.e2.type);
551
551
552
-
553
552
// Try opBinary and opBinaryRight
554
553
Dsymbol s = search_function(ad1, Id.opBinary);
555
554
556
- if (s)
555
+ if (s && ! (s.isTemplateDeclaration() || s.isOverloadSet) )
557
556
{
558
- if (OverloadSet os = s.isOverloadSet())
559
- {
560
- /*
561
- //printf("opBinary is an overload set\n");
562
- //multiple overloads in different scopes
563
- auto dti = new DotTemplateInstanceExp(e.loc, e.e1, Id.opBinary, opToArg(sc, e.op));
564
- //dtitype = new TypeIdentifier(Loc.initial, ttp.ident);
565
- if (!findTempDecl(dti, sc))
566
- {
567
- .error(e.loc, "Couldn't find the template declaration for opBinary");
568
- return ErrorExp.get();
569
- }
570
- s = dti.ti.tempdecl;
571
- //printf("found temp decl in the overload set: %s\n", s.toChars);
572
- */
573
- s = os;
574
- }
575
- else if (! s.isTemplateDeclaration())
576
- {
577
- error(e.e1.loc, " `%s.opBinary` isn't a template" , e.e1.toChars());
578
- return ErrorExp.get ();
579
- }
557
+ error(e.e1.loc, " `%s.opBinary` isn't a template" , e.e1.toChars());
558
+ return ErrorExp.get ();
580
559
}
581
560
582
561
Dsymbol s_r = search_function(ad2, Id.opBinaryRight);
583
- // TODO same check for opBinaryRight
584
- if (s_r)
562
+ if (s_r && ! (s_r.isTemplateDeclaration() || s_r.isOverloadSet()))
585
563
{
586
- if (OverloadSet os = s_r.isOverloadSet())
587
- {
588
- s_r = os;
589
- }
590
- else if (! s_r.isTemplateDeclaration())
591
- {
592
- error(e.e2.loc, " `%s.opBinaryRight` isn't a template" , e.e2.toChars());
593
- return ErrorExp.get ();
594
- }
564
+ error(e.e2.loc, " `%s.opBinaryRight` isn't a template" , e.e2.toChars());
565
+ return ErrorExp.get ();
595
566
}
596
567
if (s_r && s_r == s) // https://issues.dlang.org/show_bug.cgi?id=12778
597
568
s_r = null ;
0 commit comments