http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57995

            Bug ID: 57995
           Summary: [4.72, C++11] Lambda [&] wrongly states catch(...)
                    must be the last handler when variable by-reference
                    capture occurs within catch(...) scope
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: devcontrib4590 at gmail dot com

Created attachment 30559
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30559&action=edit
Example Code that shows 2 failures and 2 passing cases.

The following code snippet (see attachment for full code), produces the error,
"error: ‘...’ handler must be the last handler for its try block
[-fpermissive]", but explict capture of the variable rv, or usage of rv outside
of the catch(...) scope.


// $ g++ --version
// g++ (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)
// Copyright (C) 2012 Free Software Foundation, Inc.
// This is free software; see the source for copying conditions.  There is NO
// warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// $ cat /etc/redhat-release 
// Fedora release 18 (Spherical Cow)
//
// $ uname -a
// Linux redacted 3.9.11-200.fc18.x86_64 #1 SMP Mon Jul 22 21:04:50 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux

    bool rv;

    auto broken = [&] () 
    {
        try
        {

        }
        catch(...)
        {
            // Capturing a variable here produces an error related to exception
handling
            rv=false;
        }
    };

Reply via email to