[Bug c++/20484] No proper linkage created for in class initialized static const

dopheide at fmf dot nl gcc-bugzilla@gcc.gnu.org
Tue Mar 15 18:47:00 GMT 2005

------- Additional Comments From dopheide at fmf dot nl  2005-03-15 18:46 -------
You are correct. I was wrong.

I thought, because of consistency reasons, that
1) both should link, or
2) both shouldn't link.
(And I choose 1) for the "bug"-report.)

As I now understand it, the "static int const A = 1;" will be seen as an
"integral constant expression". If, OTOH, a reference has to be taken, it is
seen as a "normal int", thus requiring an actual definition. (It is in 9.4.2 of
the standard.)

See also bugs 14404, 13259, 15244, 17673.

(I search the bugs database before filing, but could not find it.)

It stills /looks/ inconsistent though.



More information about the Gcc-bugs mailing list