This is an archive of the discontinued LLVM Phabricator instance.

CWG2635: Disallow constrained structured bindings.
ClosedPublic

Authored by erichkeane on Nov 28 2022, 12:21 PM.

Details

Summary

CWG2635 prohibits adding a constraint to a structured as a defect
report. This patch implements that restriction.

Diff Detail

Event Timeline

erichkeane created this revision.Nov 28 2022, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 12:21 PM
erichkeane requested review of this revision.Nov 28 2022, 12:21 PM

I would normally not really need a review here, but I did some stuff with the fixit that I'm not sure about/not sure how to test, so I was hoping someone could take a second look

The changes look correct to me. The way to test the fix-it behavior is to model after one of the tests in https://github.com/llvm/llvm-project/tree/main/clang/test/FixIt (there is -fdiagnostics-parseable-fixits and friends for this purpose).

clang/include/clang/Basic/DiagnosticSemaKinds.td
495–496

I think clang-format butchered your formatting, you should use the more typical style.

clang/lib/Sema/SemaDeclCXX.cpp
765–768
erichkeane marked 2 inline comments as done.
aaron.ballman accepted this revision.Nov 28 2022, 2:12 PM

LGTM, but please add a release note when landing.

This revision is now accepted and ready to land.Nov 28 2022, 2:12 PM
This revision was landed with ongoing or failed builds.Nov 28 2022, 2:41 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 2:41 PM