[Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same.

i.nixman at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 10 19:52:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895

             Bug #: 54895
           Summary: the compiler treats '__cdecl' & '__stdcall' as the
                    same.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: i.nixman@gmail.com


When I compile this simple code:
void myfoo(void(__cdecl*)()){}
void myfoo(void(__stdcall*)()){}
int main(){}


I get the following error:
Assembler messages:
Error: symbol `__Z5myfooPFvvE' is already defined

Why the compiler treats theese two specificators as the same?


Another example code work as expected:
template<typename T, typename U>
struct is_same {
        enum { value = 0 };
};

template<typename T>
struct is_same<T, T> {
        enum { value = 1 };
};

int main() {
        typedef void(__stdcall* stdcall_func_ptr)();
        typedef void(__cdecl* cdecl_func_ptr)();

        return is_same<stdcall_func_ptr, cdecl_func_ptr>::value;
}

main returns 0



More information about the Gcc-bugs mailing list