Language
C++
Compiler
gcc 10.1.0
Options
Warnings
Boost 1.73.0
C++2a(GNU)
no pedantic
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.73.0/gcc-10.1.0/include -std=gnu++2a 2
Exit Code:
0
Author
anonymous
over 5 years ago
C++
gcc 10.1.0
Author
anonymous
over 5 years ago
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.73.0/gcc-10.1.0/include -std=gnu++2a prog.cc: In function 'int main()':
prog.cc:18:21: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
18 | std::cout<<(a + b);
| ^
prog.cc:11:38: note: candidate 1: 'int operator+(const T&, const P&) [with T = A; P = B]'
11 | template<typename T, typename P> int operator+(const T&, const P&) { return 2; } // Function 2
| ^~~~~~~~
prog.cc:8:30: note: candidate 2: 'int A::operator+(const T&) const [with T = B]'
8 | template<typename T> int operator+(const T&) const { return 1; } // Function 1
| ^~~~~~~~
2