This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/25811] New: No failure creating a POD containing a const member, using new without a new-initializer.


$ cat podnew.cpp

struct Foo // POD
{
    double const d;
};

int main()
{
    Foo* foo = new Foo; // without the new-initializer
}

This simple code does not fail to compile.
According to the standard (5.3.4.15), I am not sure, but i think it should fail
to compile.

$ g++ podnew.cpp && echo "no failure"
no failure

I use gcc-4.0.2, but it is the same behaviour with 3.4.4.

$ g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.0.2-r1/work/gcc-4.0.2/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.0.2
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.0.2/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.0.2
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.0.2/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.0.2/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.0.2/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-libgcj --enable-languages=c,c++,f95 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.0.2 (Gentoo 4.0.2-r1, pie-8.7.8)


-- 
           Summary: No failure creating a POD containing a const member,
                    using new without a new-initializer.
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fabien dot chene at laposte dot net
 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=25811


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]