Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.old-deja/g++.robertl/eb22.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// { dg-do assemble } // Ambiguous conversion, three candidates: // builtin == (int, int), and the two user-defined operators // Each one requires a user-defined ICS where another uses builtin conversions, // so none is the best viable function. class MyInt { public: MyInt(int = 0) {} operator int() const {return 2;} }; bool operator==(const MyInt& a, const int& b) // { dg-message "operator==" "" { target c++17_down } } { return (int)a == b; } bool operator==(const MyInt& a, const MyInt& b) // { dg-message "operator==" "" { target c++17_down } } { return (int)a == (int)b; } bool f() { return 3 == MyInt(); // { dg-error "ambiguous" "err" { target c++17_down } } }