Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2956 closed defect (duplicate)

iostream compilation error: declaration of 'void* operator new [](size_t) throw (std::bad_alloc)' has a different exception specifier

Reported by: neteler Owned by: grass-dev@…
Priority: blocker Milestone: 7.0.4
Component: Compiling Version: 7.0.3
Keywords: iostream Cc:
CPU: All Platform: Linux

Description

I'm trying to build GRASS GIS 7.0.3 for various Fedora/EPEL versions using Fedora's COPR (chroot based compile environment).

The following error appears:

make[5]: Leaving directory '/builddir/build/BUILD/grass-7.0.3/lib/python/imaging'
make[4]: Leaving directory '/builddir/build/BUILD/grass-7.0.3/lib/python'
make[3]: Leaving directory '/builddir/build/BUILD/grass-7.0.3/lib/python'
make[3]: Entering directory '/builddir/build/BUILD/grass-7.0.3/lib/iostream'
test -d OBJ.x86_64-redhat-linux-gnu || mkdir -p OBJ.x86_64-redhat-linux-gnu
c++  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC  -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include    -DPACKAGE=\""grasslibs"\"   -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -DRELDIR=\"lib/iostream\" -o OBJ.x86_64-redhat-linux-gnu/mm_utils.o -c mm_utils.cpp
c++  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC  -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include    -DPACKAGE=\""grasslibs"\"   -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -DRELDIR=\"lib/iostream\" -o OBJ.x86_64-redhat-linux-gnu/ami_stream.o -c ami_stream.cpp
c++  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC  -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include    -DPACKAGE=\""grasslibs"\"   -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -DRELDIR=\"lib/iostream\" -o OBJ.x86_64-redhat-linux-gnu/mm.o -c mm.cpp
c++  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC  -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include    -DPACKAGE=\""grasslibs"\"   -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -I/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include -DRELDIR=\"lib/iostream\" -o OBJ.x86_64-redhat-linux-gnu/rtimer.o -c rtimer.cpp
mm.cpp: In function 'void* operator new [](size_t)':
mm.cpp:279:7: error: declaration of 'void* operator new [](size_t) throw (std::bad_alloc)' has a different exception specifier
 void* operator new[] (size_t sz) throw(std::bad_alloc) {
       ^~~~~~~~
In file included from mm.cpp:49:0:
/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include/grass/iostream/mm.h:132:17: note: from previous declaration 'void* operator new [](std::size_t)'
   friend void * operator new[](size_t) throw(std::bad_alloc);
                 ^~~~~~~~
mm.cpp: In function 'void* operator new(size_t)':
mm.cpp:330:7: error: declaration of 'void* operator new(size_t) throw (std::bad_alloc)' has a different exception specifier
 void* operator new (size_t sz) throw(std::bad_alloc) {
       ^~~~~~~~
In file included from mm.cpp:49:0:
/builddir/build/BUILD/grass-7.0.3/dist.x86_64-redhat-linux-gnu/include/grass/iostream/mm.h:131:17: note: from previous declaration 'void* operator new(std::size_t)'
   friend void * operator new(size_t) throw(std::bad_alloc);
                 ^~~~~~~~
../../include/Make/Compile.make:35: recipe for target 'OBJ.x86_64-redhat-linux-gnu/mm.o' failed
make[3]: *** [OBJ.x86_64-redhat-linux-gnu/mm.o] Error 1
make[3]: Leaving directory '/builddir/build/BUILD/grass-7.0.3/lib/iostream'

It happens both on i386/i686 and x86_64.

Change History (3)

comment:1 by neteler, 8 years ago

See also #2871

comment:2 by neteler, 8 years ago

Priority: normalblocker
Resolution: duplicate
Status: newclosed

comment:3 by wenzeslaus, 8 years ago

In 68912:

use exception specifiers only for C++ versions older than C++11 (backport r68818, closes #2871, see #2956)

Note: See TracTickets for help on using tickets.