Bug 2336713

Summary: meshlab fails to build with GCC 15 (C++ "different exception specifier")
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: dmalcolm, fweimer, jakub, jason, jlaw, josmyers, jwakely, mcermak, mhroncok, mpolacek, msebor, nickc, nixuser, sipoyare, spacewar, spotrh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-01-17 14:11:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2333037    

Description Dave Malcolm 2025-01-09 19:27:22 UTC
I'm experimentally rebuilding rawhide with the not-yet-released GCC 15 to see if anything breaks, and to help write the porting guide.  See https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15

My test build with GCC 15 failed:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed/build/8476742/

whereas my test build with GCC 14 succeeded:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed.checker/build/8478970/

Looking at the failure logs e.g.
https://download.copr.fedorainfracloud.org/results/dmalcolm/gcc-15-smoketest-3.failed/fedora-rawhide-x86_64/08476742-meshlab/builder-live.log.gz
I see:

 11124 | /builddir/build/BUILD/meshlab-2023.12-build/meshlab-MeshLab-2023.12/src/external/downloads/u3d-1.5.1/RTL/IFXCorePluginStatic/IFXCorePluginStatic.cpp:141:9: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
 11125 |   141 |         throw(std::bad_alloc)
 11126 |       |         ^~~~~
>11127 | /builddir/build/BUILD/meshlab-2023.12-build/meshlab-MeshLab-2023.12/src/external/downloads/u3d-1.5.1/RTL/IFXCorePluginStatic/IFXCorePluginStatic.cpp:139:7: error: declaration of 'void* operator new(size_t) throw (std::bad_alloc)' has a different exception specifier
 11128 |   139 | void* operator new( size_t byteCount )
 11129 |       |       ^~~~~~~~
 11130 | In file included from /builddir/build/BUILD/meshlab-2023.12-build/meshlab-MeshLab-2023.12/src/external/downloads/u3d-1.5.1/RTL/IFXCorePluginStatic/IFXCorePluginStatic.cpp:34:
 11131 | /usr/include/c++/15/new:137:26: note: from previous declaration 'void* operator new(std::size_t)'
 11132 |   137 | _GLIBCXX_NODISCARD void* operator new(std::size_t)
 11133 |       |                          ^~~~~~~~

I'm wondering if something changed in g++ or C++ stdlib.

Reproducible: Didn't try

Comment 1 Jonathan Wakely 2025-01-09 19:29:51 UTC
Minimised reproducer, using -std=c++11:

#include <new>
void *operator new(std::size_t x) throw(std::bad_alloc);

Comment 2 Jonathan Wakely 2025-01-09 19:31:59 UTC
Jason suggested it probably started to be rejected with https://gcc.gnu.org/r15-3532-g7cebc6384a0ad6 which seems likely.

It might make sense to relax the error to a warning for the specific case of definitions of operator new, because in C++98 it was required to declare them as throw(std::bad_alloc).

Comment 3 Jason Merrill 2025-01-09 21:32:05 UTC
r15-6751-gfab96de044f1f0 should fix this.

Comment 4 Jonathan Wakely 2025-01-09 23:25:21 UTC
Looks like it was actually the previous commit, r15-6750-g3cae3a80695e5a

Comment 5 Miro Hrončok 2025-01-10 10:13:03 UTC
I am a tad confused. Do we need to fix mashlab, or do you use this a forum to discuss changes in gcc, and will eventually turn this into NOTABUG?

Comment 6 Miro Hrončok 2025-01-10 10:13:30 UTC
...use this as a forum...

Comment 7 Jonathan Wakely 2025-01-10 10:25:18 UTC
Dave is filing FTBFS bugs for test rebuilds with GCC 15. Most of them are package bugs that should be fixed. In this case the package does contain code that is technically invalid in current C++ standards, but GCC has been relaxed to allow it with a warning. So this one will probably get closed as NOTABUG.

Comment 8 Siddhesh Poyarekar 2025-01-17 14:09:55 UTC
Moving this to gcc since the gcc bug seems to have been fixed. I'm filing a separate bug for the failures I'm currently seeing now, since they're meshlab bugs.