This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44673] static const variable works in if/else, fails at linking in ternary
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jun 2010 10:35:14 -0000
- Subject: [Bug c++/44673] static const variable works in if/else, fails at linking in ternary
- References: <bug-44673-19370@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from manu at gcc dot gnu dot org 2010-06-26 10:35 -------
(In reply to comment #11)
> [class.static.data]/3
> If a static data member is of const literal type, its declaration in the class
> definition can specify a brace-or-equal-initializer ... The member shall
> still be defined in a namespace scope if it is used in the program and
> the namespace scope definition shall not contain an initializer.
>
> [basic.def.odr] explains what "used" means.
>
> The code is invalid, I don't think it does users a service to accept it.
So is g++ accepting invalid code?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673