aaron.ballman added a comment.

> 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."


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