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

#2956: iostream compilation error: declaration of 'void* operator new (size_t)
throw (std::bad_alloc)' has a different exception specifier
-----------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Compiling | Version: 7.0.3
Keywords: iostream | CPU: All
Platform: Linux |
-----------------------+-------------------------
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.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2956&gt;
GRASS GIS <https://grass.osgeo.org>

#2956: iostream compilation error: declaration of 'void* operator new (size_t)
throw (std::bad_alloc)' has a different exception specifier
------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.4
Component: Compiling | Version: 7.0.3
Resolution: | Keywords: iostream
       CPU: All | Platform: Linux
------------------------+-------------------------

Comment (by neteler):

See also #2871

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2956#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#2956: iostream compilation error: declaration of 'void* operator new (size_t)
throw (std::bad_alloc)' has a different exception specifier
------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.4
Component: Compiling | Version: 7.0.3
Resolution: duplicate | Keywords: iostream
       CPU: All | Platform: Linux
------------------------+-------------------------
Changes (by neteler):

* priority: normal => blocker
* status: new => closed
* resolution: => duplicate

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2956#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#2956: iostream compilation error: declaration of 'void* operator new (size_t)
throw (std::bad_alloc)' has a different exception specifier
------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.4
Component: Compiling | Version: 7.0.3
Resolution: duplicate | Keywords: iostream
       CPU: All | Platform: Linux
------------------------+-------------------------

Comment (by wenzeslaus):

In [changeset:"68912" 68912]:
{{{
#!CommitTicketReference repository="" revision="68912"
use exception specifiers only for C++ versions older than C++11 (backport
r68818, closes #2871, see #2956)
}}}

--
Ticket URL: </ticket/2956#comment:3>
GRASS GIS <https://grass.osgeo.org>