In file included from /usr/include/c++/4.7/memory:87:0,
from prog.cpp:1:
/usr/include/c++/4.7/bits/shared_ptr.h: In instantiation of ‘std::shared_ptr<_Tp1> std::dynamic_pointer_cast(const std::shared_ptr<_Tp2>&) [with _Tp = Y; _Tp1 = X]’:
prog.cpp:14:64: required from here
/usr/include/c++/4.7/bits/shared_ptr.h:450:50: error: cannot dynamic_cast ‘(& __r)->std::shared_ptr<X>::<anonymous>.std::__shared_ptr<_Tp, _Lp>::get<X, (__gnu_cxx::_Lock_policy)2u>()’ (of type ‘struct X*’) to type ‘struct Y*’ (source type is not polymorphic)