This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/8859] [CygWin] Initializer element allegedly not constant


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dannysmith at gcc dot gnu dot org  2003-07-17 10:55 -------
This should be closed, IMO.  The initializer element is not constant, as 
explained in my last post, so the error report is valid.

Here is minimal testcase:

__declspec (dllimport) int foo;
int*  hook = &foo;

This is what MS compiler say about it:
cl /c address.c
d:\develop\bugs\address.c(2) : error C2099: initializer is not a constant

This is what gcc (3.4) says:
gcc -c address.c 
address.c:2: error: initializer element is not constant

A workaround is available for dllimported function addresses (not data) and 
that is to use -mnop-fun-dllimport switch to ignore the attribute for functions

Danny


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]