http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57691
Bug ID: 57691 Summary: freestanding libstdc++ has compile error Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: bernd.edlinger at hotmail dot de Created attachment 30349 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30349&action=edit Proposed fix for this problem Hello, I want to compile the gcc-4.8.1 in a freestanding environment (eCos) but I encountered a compile error in libstdc++-v3/libsupc++/atexit_thread.cc: ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc: In function 'void {anonymous}::key_init()': ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc:87:21: error: no matches converting function 'run' to type 'void (*)(...) std::atexit (run); ^ ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc:66:8: note: candidates are: void {anonymous}::run() void run () ^ ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc:58:8: note: void {anonymous}::run(void*) void run (void *p) ^ ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc: In function 'int __cxxabiv1::__cxa_thread_atexit(void (*)(void*), void*, void*)': ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc:109:20: error: no matches converting function 'run' to type 'void (*)(...)' std::atexit (run); ^ ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc:66:8: note: candidates are: void {anonymous}::run() void run () ^ ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/atexit_thread.cc:58:8: note: void {anonymous}::run(void*) void run (void *p) ^ The used config parameters are: ../gcc-4.8.1/configure --target=arm-eabi --prefix=/home/ed/gnu/arm-eabi --with-newlib --enable-languages=c,c++ --disable-hosted-libstdcxx --disable-__cxa_atexit The compiler is simply right to complain about the ambiguity here: The problem is the function atexit() that is declared in cstdlib to take a parameter 'void (*)()' which means any parameter or nothing can match. now there are two global functions named run in this scope one declared 'void run()' and one declared void run(void*)'. The first one would be the correct choice. To fix that I had to changemthe declaration of atexit() in cstdlib: atexit(void (*)()) => atexit(void (*)(void)) which is consistent with glibc's atexit() declaraion in stdlib.h furthermore the declaration of at_quick_exit() has the same bug.