[llvm-bugs] [Bug 24436] New: condition_variable::wait could throw an exception despite being noexcept

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 12 07:49:33 PDT 2015


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

            Bug ID: 24436
           Summary: condition_variable::wait could throw an exception
                    despite being noexcept
           Product: libc++
           Version: 3.7
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: manuel.freiberger at gmx.at
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Hello,

Reading through the code, I have seen that condition_variable::wait() in
condition_variable.cpp:39 does potentially throw a system_error although
the function has a noexcept specification. Throwing an exception and 
marking the function noexcept at the same time seems inconsistent to me.

Having a glance at the C++ standard, I do not see a noexcept specifier
for condition_variable::wait(). So one solution would be to remove
the noexcept from the source code. 

If this is not desired, I think it would be more consistent to replace the 
exceptions by assertions similar to what recursive_mutex::unlock() does.
The exception cannot reach the user anyway as std::terminate() whould
be called before.

The function condition_variable::__do_timed_wait() suffers from the same
problem.

Best regards,
Manuel

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150812/8cc8b354/attachment-0001.html>


More information about the llvm-bugs mailing list