prog.cpp: In function ‘std::unique_ptr<base> f()’:
prog.cpp:10:14: error: invalid conversion from ‘std::unique_ptr<derived>’ to ‘std::unique_ptr<derived>&&’ [-fpermissive]
In file included from /usr/include/c++/4.7/memory:86:0,
from prog.cpp:1:
/usr/include/c++/4.7/bits/unique_ptr.h:155:2: error: initializing argument 1 of ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = derived; _Ep = std::default_delete<derived>; <template-parameter-2-3> = void; _Tp = base; _Dp = std::default_delete<base>]’ [-fpermissive]
prog.cpp:10:14: error: cannot convert ‘p’ from type ‘std::unique_ptr<derived>’ to type ‘std::unique_ptr<derived>&&’
prog.cpp:11:5: warning: control reaches end of non-void function [-Wreturn-type]