[Bug c++/48399] New: gcc46 show error when initializing a static const member with base class's constructor

lichray at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 1 10:58:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48399

           Summary: gcc46 show error when initializing a static const
                    member with base class's constructor
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lichray@gmail.com


Created attachment 23846
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23846
A sample "factory pattern" program

~> uname -a
FreeBSD compaq.yuetime 8.2-STABLE FreeBSD 8.2-STABLE #0: Mon Mar 14 02:51:28
CDT 2011     root@compaq.yuetime:/usr/obj/usr/src/sys/HOUKAGO  amd64

~> gcc46 -v
Using built-in specs.
COLLECT_GCC=gcc46
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/lto-wrapper
Target: x86_64-portbld-freebsd8.2
Configured with: ./../gcc-4.6-20110325/configure --disable-nls
--libdir=/usr/local/lib/gcc46 --libexecdir=/usr/local/libexec/gcc46
--program-suffix=46 --with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc46/include/c++/
--with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local
--with-system-zlib --disable-libgcj --prefix=/usr/local --mandir=/usr/local/man
--infodir=/usr/local/info/gcc46 --build=x86_64-portbld-freebsd8.2
Thread model: posix
gcc version 4.6.1 20110325 (prerelease) (GCC) 

This problem exists on a snapshot version. Please check whether it exists in
the release vesion.

Try to compile the program in the attachment,

~> g++46 a.cc
a.cc:20:15: error: uninitialized const 'Derived::kInstance' [-fpermissive]
a.cc:9:7: note: 'const class Derived' has no user-provided default constructor

But actually, it has a inherited constructor, and it's safe.
This problem makes gcc46 can not compile firefox4 when -fpermissive is not set.



More information about the Gcc-bugs mailing list