0
已解决
将这段代码加到main函数前:
template <class T> class KK { KK<T *> operator->(); };
#define Kill() KK<int> kk; kk->kill();
然后执行Kill()即可卡**编译器
错误信息(部分):
./eftgr.cpp: In function 'int main()':
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp: In instantiation of 'KK<T*> KK<T>::operator->() [with T = int]':
./eftgr.cpp:6:2: required from here
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int**]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int***]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int****]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*****]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int******]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*******]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int********]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*********]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int**********]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int***********]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int**************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int***************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int****************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*****************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int******************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
./eftgr.cpp:3:39: note: declared private here
3 | template <class T> class KK { KK<T *> operator->(); };
| ^~~~~~~~
./eftgr.cpp:4:30: error: 'KK<T*> KK<T>::operator->() [with T = int*******************]' is private within this context
4 | #define Kill() KK<int> kk; kk->;
| ^~
./eftgr.cpp:6:9: note: in expansion of macro 'Kill'
6 | Kill();
| ^~~~
......
看出来是把编译器整了个无限递归