steakhal planned changes to this revision.
steakhal added a comment.

In D139195#3966675 <https://reviews.llvm.org/D139195#3966675>, @aaron.ballman 
wrote:

>> Previously, only void returning functions were considered for noreturn 
>> attribute candidates. This patch removes this artificial restriction.
>
> C2x 6.7.12.6p6: The implementation should produce a diagnostic message for a 
> function declared with a noreturn attribute that appears to be capable of 
> returning to its caller.
>
> p7 has an example showing `[[noreturn]] int h(void);` with the comment 
> "Implementations are similarly encouraged to diagnose the declaration of h() 
> because it appears capable of returning to its caller due to the non-void 
> return type."
>
> So is this really an artificial restriction? To me, putting the `noreturn` 
> attribute on a function with a return type makes no sense whatsoever. The 
> interface is saying "I promise that calling me will not return" and "when I 
> return, this is the type of the value I will give you."

Hmm, I implicitly took the `__attribute__((noreturn))` suggestion and the 
non-void return type as a code-smell for the exact same reason.
You are right, we should have a clean diagnostic message for these cases 
instead of this implied suggestion.
IDK why I haven't thought about this 😅


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139195/new/

https://reviews.llvm.org/D139195

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to