https://llvm.org/bugs/show_bug.cgi?id=24690

            Bug ID: 24690
           Summary: Suspicious function-try-block warning
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: kaball...@hotmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

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

> [...] 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.

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to