This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't require deduction guides to be templates
ClosedPublic

Authored by rymiel on Dec 6 2022, 5:24 AM.

Details

Summary

The C++ standard doesn't require that class template deduction guides
be templates themselves, but previously isDeductionGuide would assert
for the existence of a template closer or requires clause closer before
the deduction guide declaration.

This patch simply removes that check. Because of this, a test which
asserted that x()->x<1>; *isn't* a deduction guide failed, as it is
now formatted as a deduction guide. However, as @JohelEGP demonstrated,
it is [possible to make that a viable deduction guide][1].

Thus, that test has been removed, but other tests related to
non-template class template deduction guides have been added.

Fixes https://github.com/llvm/llvm-project/issues/55142

[1]: https://compiler-explorer.com/z/Wx3K6d5K9

Diff Detail

Event Timeline

rymiel created this revision.Dec 6 2022, 5:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 5:24 AM
rymiel requested review of this revision.Dec 6 2022, 5:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 5:24 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rymiel added a project: Restricted Project.Dec 6 2022, 5:24 AM

Seems to be okay.

This revision is now accepted and ready to land.Dec 6 2022, 12:13 PM
owenpan accepted this revision.Dec 9 2022, 5:50 PM
This revision was landed with ongoing or failed builds.Dec 16 2022, 1:30 PM
This revision was automatically updated to reflect the committed changes.