<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Suspicious function-try-block warning"
   href="https://llvm.org/bugs/show_bug.cgi?id=24690">24690</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Suspicious function-try-block warning
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kaballo86@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following snippet generates a warning for what I think is well-defined
behavior:

    #include <iostream>

    struct foo {
      int x;

      foo() try : x(42) { throw 1; } catch (...) { std::cout << x; }
    };

    int main() {}

The warning says "cannot refer to a non-static member from the handler of a
constructor function try block", but I cannot find any references to such
restriction in the standard.

I suspect this is derived from 15.2 [except.ctor]/3

<span class="quote">> [...] The subobjects are destroyed in the reverse order of the completion of
> their construction. Such destruction is sequenced before entering a handler 
> of the function-try-block of the constructor or destructor, if any.</span >

The lifetime of an object with a trivial-destructor does not end when the
destructor call starts, but rather when the storage which the object occupies
is released.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>