https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94888
--- Comment #3 from zhangzhanli <chunqiu1234 at foxmail dot com> ---
So this is output from latest version of g++ ?
With Apple Clang, there is no such problem (recursive and segmentation fault).
MacOS Output:
jaly@Jalys-MBP gcccompared %
/Volumes/macos/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-I/Volumes/macos/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
main.cpp -O2 -g -o 1 -std=c++11
main.cpp:119:47: warning: expression result unused [-Wunused-value]
~FunctionBridger() {func ? (delete func, 1) : 0;}
^
main.cpp:119:47: warning: expression result unused [-Wunused-value]
~FunctionBridger() {func ? (delete func, 1) : 0;}
^
main.cpp:151:5: note: in instantiation of member function 'FunctionBridger<int,
char>::~FunctionBridger' requested here
Function( Ty&& func) : FunctionType<T>::type(Forward<Ty>(func)) { }
^
main.cpp:180:32: note: in instantiation of function template specialization
'Function<int (char)>::Function<int (*)(char)>' requested here
Function<int(char)> func = &f;
^
2 warnings generated.
jaly@Jalys-MBP gcccompared % ls
1 1.dSYM main.cpp
jaly@Jalys-MBP gcccompared % ./1
jaly@Jalys-MBP gcccompared % echo $?
0