[GRASS-dev] [GRASS GIS] #2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a different exception specifier
GRASS GIS
trac at osgeo.org
Thu Jun 30 12:56:42 PDT 2016
#2871: lib/iostream/mm.cpp:Fails to build with GCC 6: declaration of ... has a
different exception specifier
-------------------------+-------------------------------------------------
Reporter: sebastic | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.2.0
Component: Compiling | Version: svn-releasebranch70
Resolution: | Keywords: iostream, gcc, -fexceptions, throw,
| noexcept
CPU: All | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by wenzeslaus):
* keywords: iostream => iostream, gcc, -fexceptions, throw, noexcept
Comment:
The GCC message is pretty confusing because it points to two places with
the same specification claiming that the specification is different and
showing previous declaration coming from library I suppose. Anyway, it
seems that it all depends on the version of the standard used. C++11 and
higher wants no specifiers (they are depreciated in C++) while C++98
standard with GCC option `-fexceptions` requires them. I don't know how to
explain that the standard drafts around C++ don't specify `noexcept` for
`delete operator` but there is no difference when using GCC 5.2 with
-std=c++11 or -std=c++14; perhaps the library version is the same. I used
`__cplusplus` to figure out the C++ standard in use, it seems that it is
good enough (for g++ and clang).
The graph in the Debian bug report says 7.0.4, so this means that we need
to eventually backport it to 70 unless they switch to 72. Can somebody
conveniently test it with GCC 6?
Here are my references:
* https://gcc.gnu.org/gcc-6/changes.html: The default mode for C++ is now
`-std=gnu++14` instead of `-std=gnu++98`.
* http://en.cppreference.com/w/cpp/preprocessor/replace: `__cplusplus`:
denotes the version of C++ standard that is being used, expands to value
`199711L` (until C++11), `201103L` (C++11), or `201402L` (C++14)
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf
(<C++11):
* `void* operator new(std::size_tsize) throw(std::bad_alloc);`
* `void operator delete(void* ptr) throw();`
* ...
* http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2011/n3242.pdf and
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf
(~C++11):
* `void* operator new(std::size_t);`
* `void operator delete(void*);`
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4594.pdf
(>C++14):
* `void* operator new(std::size_t size);`
* `void operator delete(void* ptr) noexcept;`
* ...
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2871#comment:16>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list