prog.cpp: In instantiation of ‘To test() [with To = Derived*; From = Base*]’:
prog.cpp:14:26: required from here
prog.cpp:5:33: error: invalid conversion from ‘Base*’ to ‘Derived*’ [-fpermissive]
return std::declval< From >();
^
In file included from prog.cpp:1:0:
/usr/include/c++/6/type_traits: In instantiation of ‘typename std::add_rvalue_reference< <template-parameter-1-1> >::type std::declval() [with _Tp = Base*; typename std::add_rvalue_reference< <template-parameter-1-1> >::type = Base*&&]’:
prog.cpp:5:32: required from ‘To test() [with To = Derived*; From = Base*]’
prog.cpp:14:26: required from here
/usr/include/c++/6/type_traits:2270:7: error: static assertion failed: declval() must not be used!
static_assert(__declval_protector<_Tp>::__stop,
^~~~~~~~~~~~~