Fails compilation with "catching polymorphic type ‘class std::exception’"

Bug #1949632 reported by Peter Scholtens
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gnuclad
New
Undecided
Unassigned

Bug Description

On Ubuntu 20.04 the source code fails to compile with the following error message:

gnuclad.cpp: In function ‘int main(int, char**)’:
gnuclad.cpp:145:21: error: catching polymorphic type ‘class std::exception’ by value [-Werror=catch-value=]
  145 | } catch(exception e) {

Simple replacing "e" with "&e" in line 145 of gnuclad.cpp does solve the warning. It resembles the problem described here:
https://stackoverflow.com/questions/6755991/catching-stdexception-by-reference

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.