This is an archive of the discontinued LLVM Phabricator instance.

Correct the diagnostic behavior for unreachable _Generic associations in C++
ClosedPublic

Authored by aaron.ballman on May 18 2022, 6:30 AM.

Details

Summary

New diagnostics were added for unreachable generic selection expression associations in ca75ac5f04f269def97e6844c2f5c9596b29c84c, but it did not account for a difference in behavior between C and C++ regarding lvalue to rvalue conversions. So we would issue diagnostics about a selection being unreachable and then reach it. This corrects the diagnostic behavior in that case.

Diff Detail

Event Timeline

aaron.ballman created this revision.May 18 2022, 6:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 6:30 AM
aaron.ballman requested review of this revision.May 18 2022, 6:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 6:30 AM
erichkeane accepted this revision.May 18 2022, 6:44 AM

Took me a bit to get the prose, but I think I got it now. PERHAPS there is use to 'finish the thought' on the outcome there? Either way, LGTM.

clang/lib/Sema/SemaExpr.cpp
1699

This seems like it is a sentence short (or perhaps I'm a few synapses short?).

The fallout from these rules is that "Non-class-types" never have qualifiers, thus cannot match a qualified type, but a class-type can, because it keeps its qualifiers?

This revision is now accepted and ready to land.May 18 2022, 6:44 AM
aaron.ballman added inline comments.May 18 2022, 9:44 AM
clang/lib/Sema/SemaExpr.cpp
1699

The fallout from these rules is that "Non-class-types" never have qualifiers, thus cannot match a qualified type, but a class-type can, because it keeps its qualifiers?

Correct for C++ -- the basic idea is that in C, all qualifiers are stripped, and in C++, only non-class type types have their qualifiers stripped. I'll update the comment when landing.

This revision was landed with ongoing or failed builds.May 18 2022, 9:46 AM
This revision was automatically updated to reflect the committed changes.