1
0
Fork 0

Fix involuntary conversions of ExtMove to Move

The trick is to create an ambiguity for the
compiler in case an unwanted conversion to
Move is attempted like in:

    ExtMove m1{Move(17),4}, m2{Move(4),17};

    std::cout << (m1 < m2) << std::endl; // 1
    std::cout << (m1 > m2) << std::endl; // 1(!)

This fixes issue #1204

No functional change.
pull/1201/head
Marco Costalba 2017-08-13 11:01:26 -07:00
parent 9001f55147
commit d482e3a890
1 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,10 @@ struct ExtMove {
operator Move() const { return move; }
void operator=(Move m) { move = m; }
// Inhibit unwanted implicit conversions to Move
// with an ambiguity that yields to a compile error.
operator float() const;
};
inline bool operator<(const ExtMove& f, const ExtMove& s) {