[Bug c++/56230] New: gcc aborts with "uninitialized const member" error even though an initializer is present
pavelo at conky dot be
gcc-bugzilla@gcc.gnu.org
Wed Feb 6 18:57:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56230
Bug #: 56230
Summary: gcc aborts with "uninitialized const member" error
even though an initializer is present
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pavelo@conky.be
Created attachment 29375
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29375
the bug
while compiling the attached file I get the following error:
$ g++ -std=c++0x a.cc
a.cc: In constructor 'A<Keys>::A(Keys ...) [with Keys = {}]':
a.cc:25:9: instantiated from here
a.cc:15:5: error: uninitialized member 'A<>::tuple' with 'const' type 'const
Tuple {aka const atuple<>}' [-fpermissive]
In my opinion, this is wrong, since I class A explicitly calls the tuple
constructor, which should be synthesized by the compiler.
I have several observations about this code:
- the error does not occur if I remove the atuple<> specialization, or I
provide a hand written default constructor.
- it does, however, occur if I specify the constructor as "= default;"
- it does not occur if I call atuple<> constructor directly (see class B).
There has to be another template somewhere.
- I noticed this bug because I had this error when using std::tuple, which
provides an explicit specialization for the empty tuple and this specialization
has no explicit constructors.
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --without-ppl --without-cloog --enable-lto --disable-nls
--with-system-zlib --enable-obsolete --disable-werror --enable-secureplt
--enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python
--enable-checking=release --enable-java-awt=gtk --enable-libstdcxx-time
--enable-languages=c,c++,java,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.3 p1.11,
pie-0.5.2'
Thread model: posix
gcc version 4.6.3 (Gentoo 4.6.3 p1.11, pie-0.5.2)
If you need any further information, I will be happy to provide it.
More information about the Gcc-bugs
mailing list