AlexVlx wrote: > > You could default the warning to an error to make it more visible to the > user. Not certain if that's a bad idea or not though. >
Possibly. I had to drop this for a bit so circling around again, so apologies for the late reply. In the meanwhile, @epilk pointed out something I spaced out on, which is that we have some related / somewhat similar feature in Clang already: https://clang.llvm.org/docs/LanguageExtensions.html#objective-c-available, which is permissive along the lines of what you and @erichkeane are suggesting (a bit too permissive for my colleagues, I suspect, but that can be addressed by erroring). The Sema checking around that is rather extensive and I'd like to avoid duplicating / adding that amount of code. > > If I may be so bold as to inquire: would you and @AaronBallman be slightly > > less horrified if the return type variance would be replaced with returning > > an odd type that only knows how to `bool`ify itself in conditions? More > > explicitly, if instead of `void __builtin_amdgcn_processor_is(const char*)` > > what we see is `__amdgpu_predicate_t __builtin_amdgcn_processor_is(const > > char*)`, would that be somewhat less bad? There is precedent for > > special-ish builtins returning special-ish target types (please consider > > `__amdgpu_buffer_rsrc_t` for `__builtin_amdgcn_make_buffer_rsrc` or > > `svcount_t`) > > That would be just as weird, IMO. Having something that's contextually > converted to bool but only in some contexts, is going to be confusing in > practice. Well, there's an interim solution here where it'd actually look essentially like so: ```cpp struct __amdgpu_predicate_t { explicit operator bool() const noexcept; } ``` Which forces the user to consciously cast, unless in a valid (e.g. `if` context), and allows for the Sema checking to be funneled into a single point (the cast). Obligatory handwavium godbolt for illustration: <https://gcc.godbolt.org/z/cGT7TPrjE> https://github.com/llvm/llvm-project/pull/134016 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits