[PATCH] D140868: [C] Make (c ? e1 : e2) noreturn only if both e1 and e2 are noreturn

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 3 13:12:08 PST 2023


aaron.ballman added a comment.

In D140868#4024087 <https://reviews.llvm.org/D140868#4024087>, @rjmccall wrote:

> Isn't the C feature not technically part of the type?  I thought Clang was fairly unique in modeling `noreturn` the way we do.

That's true, I just verified I didn't change that as part of https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf when doing `[[noreturn]]`. That makes this more reasonable than I was originally thinking, but it still makes me a bit uneasy. We form a composite type in two situations: needing a common type for `?:` and when doing function redeclaration merging. It seems odd to me that we would treat those differently, but at the same time, the rationale for why `?:` should be conservative makes a lot of sense to me.

What do GCC and ICC do in this case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140868



More information about the cfe-commits mailing list