This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/8859] [CygWin] Initializer element allegedly not constant
- From: "dannysmith at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2003 10:55:36 -0000
- Subject: [Bug c/8859] [CygWin] Initializer element allegedly not constant
- References: <20021207074600.8859.mlt@bredband.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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