efriedma-quic wrote: > This can be fixed if the block is copied via `__Block_copy` and assigned it > to b after the static initialization. b then points to a heap block, so later > calls are fine. But the captures have to be kept alive until the block is > copied.
There's no way to run the `__Block_copy` in time to prevent races (unless you stick it in the initializer itself, in which case it's like the ARC case). > Even without the `__Block_copy`, the function is well defined if it only runs > once. I don't think anything in the standard makes the code invalid just > because it can't be invoked more than once. It's self-consistent, I guess, given a rule that a block literals always have automatic storage duration, but it's basically never what anyone would want. https://github.com/llvm/llvm-project/pull/199508 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
