fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <cctype>
  5. #include <cstdlib>
  6. #include <stdexcept>
  7. #include <initializer_list>
  8.  
  9. using namespace std;
  10.  
  11. constexpr size_t sz() { return 42; }
  12. constexpr size_t scale (size_t i) { return i * sz(); }
  13.  
  14. bool f (const string &s1, const string &s2) { cout << "function called" << endl; return 0; }
  15. bool g (const string &s1, const string &s2);
  16.  
  17. decltype(g) *xynta(int i)
  18. {
  19. return i % 2 ? &f : &g;
  20. }
  21.  
  22. int main()
  23. {
  24. int i = 2;
  25. int a[scale(i)];
  26.  
  27. string x = "xxx", y = "yyy";
  28. decltype(g) *pf = f;
  29. (*pf)(x, y);
  30. }
  31.  
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/aBzYs7/ccabaCQF.o: In function `xynta(int)':
prog.cpp:(.text+0xdd): undefined reference to `g(std::string const&, std::string const&)'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty