public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56230] New: gcc aborts with "uninitialized const member" error even though an initializer is present
@ 2013-02-06 18:57 pavelo at conky dot be
  2013-02-06 19:35 ` [Bug c++/56230] " daniel.kruegler at googlemail dot com
  2013-02-06 22:49 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pavelo at conky dot be @ 2013-02-06 18:57 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/56230] gcc aborts with "uninitialized const member" error even though an initializer is present
  2013-02-06 18:57 [Bug c++/56230] New: gcc aborts with "uninitialized const member" error even though an initializer is present pavelo at conky dot be
@ 2013-02-06 19:35 ` daniel.kruegler at googlemail dot com
  2013-02-06 22:49 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-02-06 19:35 UTC (permalink / raw)
  To: gcc-bugs


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-02-06 19:35:15 UTC ---
The problem seems to be fixed in 4.7.2 and in 4.8.0 trunk.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/56230] gcc aborts with "uninitialized const member" error even though an initializer is present
  2013-02-06 18:57 [Bug c++/56230] New: gcc aborts with "uninitialized const member" error even though an initializer is present pavelo at conky dot be
  2013-02-06 19:35 ` [Bug c++/56230] " daniel.kruegler at googlemail dot com
@ 2013-02-06 22:49 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-06 22:49 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-06 22:48:21 UTC ---
Yes, fails with 4.5, 4.5 and 4.6 but already fixed.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-06 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 18:57 [Bug c++/56230] New: gcc aborts with "uninitialized const member" error even though an initializer is present pavelo at conky dot be
2013-02-06 19:35 ` [Bug c++/56230] " daniel.kruegler at googlemail dot com
2013-02-06 22:49 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).