[PATCH] D125919: Drop qualifiers from return types in C (DR423)
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 12:26:32 PDT 2022
rjmccall added a comment.
In D125919#3554078 <https://reviews.llvm.org/D125919#3554078>, @delcypher wrote:
> @aaron.ballman Hey I just saw this change and had questions about it. For others looking I think the resolution to DR423 is in https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1863.pdf, I found https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_423 hard to parse.
>
> 1. It looks like we're completely dropping qualifiers on the return types of function in C. If that's the case, what's even the point of having qualifiers on return types of functions?
I think that's the point: qualifiers don't mean anything on return types, so they shouldn't be represented in the type. If the user writes a qualifier directly on the return type, like `const int twice(int x);`, we should warn about that; otherwise they should be silently dropped.
> 2. Reading DR423 I see the problem but I don't understand why the desire to make `_Generic` work better in the presence of qualifiers means that qualifiers on function return types have to be dropped in all contexts. Couldn't this just be a thing that is done inside `_Generic` and no where else?
>
> Sorry if these are silly questions and if I've misunderstood something, I saw n1863 say "functions return unqualified types" and I was very surprised.
Just to be clear, you understand that this is only about top-level qualifiers on the return type, right? `const void *foo();` is still meaningful, it's just that `const void * const foo();` isn't.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125919/new/
https://reviews.llvm.org/D125919
More information about the cfe-commits
mailing list