Language
C++
Compiler
gcc HEAD 10.0.0 20190710 (experimental)
Options
Warnings
Boost 1.70.0
C++2a(GNU)
no pedantic
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.70.0/gcc-head/include -std=gnu++2a
Exit Code:
1
Author
anonymous
about 6 years ago
C++
gcc HEAD 10.0.0 20190710 (experimental)
Author
anonymous
about 6 years ago
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.70.0/gcc-head/include -std=gnu++2a
prog.cc: In function 'int main()':
prog.cc:14:8: error: conversion from 'S' to 'int' is ambiguous
14 | foo(s);
| ^
prog.cc:5:3: note: candidate: 'S::operator unsigned int() const'
5 | operator unsigned() const { return 1; };
| ^~~~~~~~
prog.cc:6:3: note: candidate: 'S::operator long int() const'
6 | operator long() const { return 2; };
| ^~~~~~~~
prog.cc:9:14: note: initializing argument 1 of 'void foo(int)'
9 | void foo(int i) {std::cout << i;}
| ~~~~^