[Bug other/20426] error: initializer element is not constant

pluto at pld-linux dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 11 14:20:00 GMT 2005


------- Additional Comments From pluto at pld-linux dot org  2005-03-11 14:19 -------
(In reply to comment #2)
> Note in C++ they will be constants though but not in C.  C has different rules
for constant expressions 
> than C++.

Thanks for explain. I have one more basic question.
Why the non-static symbol isn't exported from C++ module?
In C only static symbols aren't exported. What about C++?

[ cat ver.cpp ]
static const unsigned major = 0;
static const unsigned minor = 9;
static const unsigned build = 1;
const unsigned version = (major << 24) | (minor << 16) | build;

[ ver.s ]
.file   "ver.cpp"
.ident  "GCC: (GNU) 4.0.0 20050305 (prerelease) (PLD Linux)"
.section        .note.GNU-stack,"",@progbits


-- 


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



More information about the Gcc-bugs mailing list