fork download
  1. #include <memory>
  2. struct point { int x, z; };
  3. int main() { std::make_unique<point>(1, 2); }
  4.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from prog.cpp:1:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/memory:81:
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/unique_ptr.h:791:34: error: no matching constructor for initialization of 'point'
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:3:19: note: in instantiation of function template specialization 'std::make_unique<point, int, int>' requested here
int main() { std::make_unique<point>(1, 2); }
                  ^
prog.cpp:2:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct point { int x, z; };
       ^
prog.cpp:2:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
prog.cpp:2:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
1 error generated.
stdout
Standard output is empty