fork download
  1. struct stg
  2. {
  3. struct cvt { const char* p; cvt(const char* p_p) : p(p_p) {} };
  4.  
  5. stg(cvt c_str);
  6.  
  7. template<int N>
  8. stg(const char (&str) [N]);
  9. };
  10.  
  11.  
  12. int main() {
  13. const char* c_str = "foo";
  14. stg foo(c_str); // ok will call string(const char*)
  15.  
  16. stg bar("bar"); // call string(const char*) instead of the array version
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/zb6Qr4/cciU8Nd6.o: In function `main':
prog.cpp:(.text.startup+0x19): undefined reference to `stg::stg(stg::cvt)'
prog.cpp:(.text.startup+0x2d): undefined reference to `stg::stg<4>(char const (&) [4])'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty