fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. double stod( const std::string& str, std::size_t* pos = 0 ) { std::cout << "Oops"; }
  7.  
  8. int main() {
  9. const std::string a("1.2");
  10. std::cout << stod(a) << std::endl;
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 3456KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:10:21: error: call of overloaded 'stod(const string&)' is ambiguous
  std::cout << stod(a) << std::endl;
                     ^
prog.cpp:6:8: note: candidate: double stod(const string&, std::size_t*)
 double stod( const std::string& str, std::size_t* pos = 0 ) { std::cout << "Oops"; }
        ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:5286:3: note: candidate: double std::stod(const string&, std::size_t*)
   stod(const string& __str, size_t* __idx = 0)
   ^
stdout
Standard output is empty