From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19027 invoked by alias); 19 Mar 2005 14:03:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18935 invoked by uid 48); 19 Mar 2005 14:03:43 -0000 Date: Sat, 19 Mar 2005 14:03:00 -0000 Message-ID: <20050319140343.18934.qmail@sourceware.org> From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050319065920.20547.Hu.YuehWei@gmail.com> References: <20050319065920.20547.Hu.YuehWei@gmail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/20547] undefined reference to "static const" fields of classes X-Bugzilla-Reason: CC X-SW-Source: 2005-03/txt/msg02329.txt.bz2 List-Id: ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-19 14:03 ------- (In reply to comment #2) > But according the standard, 'const static' data members of an intergral type can > now be initialized _inside_ their class. In this case, the initialization is > _also_ a definition, so _no_ further definitions are reuquired outside the class > body. No it is not a definition, a definition (or is it the other way around). Still this is invalid. Yes the compiler is allowed to "optimize" the constant which is why it worked in 2.95.3 (well because the defintion of push_back was wrong). Oh, one more thing, the vector code is equivalent to (so you take the address): struct T { static char const a = 3; }; void fff(const char &a){ } int main() { fff(T::a); return 0; } -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20547