From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17828 invoked by alias); 6 Feb 2013 18:57:25 -0000 Received: (qmail 15866 invoked by uid 48); 6 Feb 2013 18:56:45 -0000 From: "pavelo at conky dot be" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56230] New: gcc aborts with "uninitialized const member" error even though an initializer is present Date: Wed, 06 Feb 2013 18:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pavelo at conky dot be X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2013-02/txt/msg00570.txt.bz2 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::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.