Opened 6 months ago
Closed 5 months ago
#306 closed defect (fixed)
Waituntil relies on RAII-unsound rvalue-to-reference conversion
Reported by: | mlbrooks | Owned by: | lseo |
---|---|---|---|
Priority: | major | Component: | libcfa |
Version: | 1.0 | Keywords: | waituntil raii rvalue reference dlist |
Cc: |
Description
Waituntil uses rvalue-to-reference conversion, probably without realizing it. Types that underlie its implementation should be free to use advanced RAII, which does not support (#305) waituntil's rvalue-to-reference conversion case.
A desired linked-list implementation change (not yet in master) causes the return value of timeout
to need RAII that present state rvalue-to-reference promotion does not provide.
#include <concurrency/select.hfa> int main() { waituntil( timeout( 1`ns ) ) {} return 0; }
Actual, master: Runs and exits normally
Actual, with desired linked-list change: runtime crash with assertion failure about dlist precondition not met
Expected, with desired linked-list change: Runs and exits normally
Inspecting intermediate code (at master), cfa demo.cfa -CFA -XCFA,-p,-Pbresolver
shows (manually pieced together):
typeof(__CFA_select_get_type(timeout(__postfix_func_ns(1)))) & __clause_target_0 = timeout(__postfix_func_ns(1));
Note __clause_target_0
is declared here as a reference, while timeout
(from select.hfa) has returns select_timeout_node
by value. This is the case of #305.
Change History (3)
comment:1 by , 6 months ago
Component: | cfa-cc → libcfa |
---|
comment:2 by , 6 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:3 by , 5 months ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
fixed in e1358c0ea59c560c010e5261b3e1fe2ac3ad8a2c