From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16570 invoked by alias); 26 Jul 2010 16:33:09 -0000 Received: (qmail 16423 invoked by uid 48); 26 Jul 2010 16:32:50 -0000 Date: Mon, 26 Jul 2010 16:33:00 -0000 Message-ID: <20100726163250.16422.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/45082] Static const signed int class member causes undefined symbol. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "redi at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg02887.txt.bz2 ------- Comment #3 from redi at gcc dot gnu dot org 2010-07-26 16:32 ------- (In reply to comment #2) > The bug/feature may be that re-typing BUFF_SIZE to static const unsigned int > allows the compiler to not report a problem. You're not "re-typing" it, you're providing a definition for a variable that was previously only declared, not defined. > It doesn't require a const > unsigned myclass::BUFF_SIZE; anywhere Yes it does, it requires it where you bind a reference to the variable. If you only want it to be used as an integral constant, don't use it in a context that requires a variable (e.g. reference binding) > and still compiles when it shouldn't. There are dozens of (invalid) bug reports in bugzilla about this, feel free to search for more details. The compiler must not reject your program as it doesn't know until link time that you've failed to define the symbol. It could be defined in some other object or library that you link to later. The bug was in your program, not the compiler. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45082