This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54046] New: wrong control reaches end of non-void function for switch case with throw and default
- From: "plasmahh at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Jul 2012 11:49:08 +0000
- Subject: [Bug c++/54046] New: wrong control reaches end of non-void function for switch case with throw and default
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54046
Bug #: 54046
Summary: wrong control reaches end of non-void function for
switch case with throw and default
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: plasmahh@gmx.net
Hi, somehow gcc gets confused in its control flow analysis when a default case
in a switch has a throw and break, and a variable with user defined dtor.
struct A
{
~A() { }
};
bool check( int x )
{
A z;
switch( x )
{
case 0:
return false;
default:
throw "X";
break;
}
}
When I either remove the break or the variable z, the warning will not issued
anymore.