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

            Bug ID: 51758
           Summary: Destructor of std::any should not propagate exceptions
           Product: libc++
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

See https://godbolt.org/z/Yrszd3d4f, and
https://github.com/cplusplus/draft/issues/4863#issuecomment-913215699. The
destructor fails to meet the requirements of
https://eel.is/c++draft/res.on.exception.handling#3:
> Destructor operations defined in the C++ standard library shall not throw 
> exceptions. Every destructor in the C++ standard library shall behave as if 
> it had a non-throwing exception specification.
```C++
#include <any>
struct X { ~X() noexcept(false) { throw 0; } };
int main()
try {
  std::any x{X{}};
}
catch(int) {
  throw 0ull; // Terminate on thrown int means throw within noexcept
}
```
```
Program returned: 139
libc++abi: terminating with uncaught exception of type unsigned long long
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to