https://github.com/aaronpuchert commented:

Don't want to give the wrong impression, I like the idea of this change a lot.

But I think we need to be clearer about the attribute, the return value, and 
the relation between them. The attribute needs to be a constant expression for 
sure, and it's probably Ok to limit it to literals. I don't see a reason to do 
any kind of computation in there, or have something dependent on other values 
in the code. This would seem to make for an awful interface. (But I'm happy to 
be proven wrong with compelling use cases.)

The actual return value of the function need not be of the same type. Pointers 
have been mentioned, smart pointers as well. Handles could also be interesting. 
Anything that converts to `bool`, or more generally, the type in the attribute, 
should be fine. The idea being, as long as I can write
```c++
auto ret = mu.tryLock();
if (ret)
   /*...*/;
```
we should support it. This doesn't fit the `nullptr` case, but we could mildly 
generalize that. Or we ask users to write `false` instead, see also my comment 
below.

https://github.com/llvm/llvm-project/pull/95290
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to