This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24260] New: stdcall attribute is ignored at static member template functions
- From: "ahangauer at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Oct 2005 16:40:49 -0000
- Subject: [Bug c++/24260] New: stdcall attribute is ignored at static member template functions
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC 4.0.0 / 4.0.2 seems to ignore the stdcall (and also fastcall)
attributes when used at static member template functions.
The generated code for the function is incorrect.
Also when taking the address of that function, the type is a pointer to
a "normal" function and not a pointer to a stdcall function. (See example
below). So it seems that the stdcall attribute is "lost" during parsing.
This problem only occurs when using a template function. A static stdcall
function without template works as expected.
#define stdcall __attribute__((stdcall))
struct T {
template <class S>
static int stdcall func(int arg1, int arg2);
};
// The generated assembly is incorrect. Function is not
// removing arguments, so this is clearly not "stdcall"
// ("ret" instruction at the end instead of "ret 0x8")
template <class S>
int stdcall T::func(int arg1, int arg2)
{
return arg1+arg2;
}
struct dummy {};
void xx()
{
int (*ptr)(int,int) = &T::func<dummy>; // works (although
incorrect)
// int (stdcall *ptr2)(int,int) = &T::func<dummy>; // generates error
(although correct)
}
--
Summary: stdcall attribute is ignored at static member template
functions
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ahangauer at gmx dot net
GCC build triplet: i686-pc-mingw32
GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24260