c++/1841: Incorrect error: invalid use of member '' in static member function
jb@trisignal.com
jb@trisignal.com
Fri Feb 2 12:26:00 GMT 2001
>Number: 1841
>Category: c++
>Synopsis: Incorrect error: invalid use of member '' in static member function
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Feb 02 12:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Jean-Bernard Delva
>Release: gcc version 2.95.2-6 19991024 (cygwin experimental)
>Organization:
>Environment:
i686-pc-cygwin Window NT 4.0 SP6
>Description:
The compiler rejects taking the pointer to a class data member in a static function.
CodeSourcery's Online Test Compilation gives the same error.
The same code compiles with the Diab MSVC compilers with -strict-ansi enabled.
>From gcc -v:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/specs
gcc version 2.95.2-6 19991024 (cygwin experimental)
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/cpp.exe -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Di386 -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386 -Asystem(winnt) -Acpu(i386) -Amachine(i386) -D__EXCEPTIONS -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/local/include -idirafter /usr/include -D_WIN32 -DWINNT -idirafter /usr/include/w32api Test.cpp Test.ii
>How-To-Repeat:
Compile the following:
struct X
{
static int X::* foo () { return &x; };
int x;
};
>Fix:
No suggestions.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list