This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30745] New: Undefined static const
- From: "hans dot buchmann at fhso dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2007 14:43:47 -0000
- Subject: [Bug c++/30745] New: Undefined static const
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling the code
class Class
{
public:
Class(const unsigned maxLine);
private:
static const unsigned MAX_LEN = 16;
unsigned max;
unsigned array[MAX_LEN];
};
Class::Class(const unsigned maxLine)
:max((maxLine<MAX_LEN)?maxLine
:MAX_LEN)
{
}
with the command:
g++ -Wall -O0 -fno-exceptions -c -o const-test.o const-test.cc
leaves Class::MAX_LEN undefined:
nm --demangle const-test.o
U Class::MAX_LEN
00000028 T Class::Class(unsigned int)
00000000 T Class::Class(unsigned int)
The compiler g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.1/work/gcc-4.1.1/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.1
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
--host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu
--disable-altivec
--enable-nls
--without-included-gettext
--with-system-zlib
--disable-checking
--disable-werror
--disable-libunwind-exceptions
--disable-multilib
--disable-libmudflap
--disable-libssp
--disable-libgcj
--enable-languages=c,c++,fortran
--enable-shared --enable-threads=posix
--enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1)
Best regards
Hans Buchmann
--
Summary: Undefined static const
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hans dot buchmann at fhso dot ch
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30745