[all-commits] [llvm/llvm-project] 838434: [clang-format] Don't require deduction guides to b...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Fri Dec 16 13:30:26 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8384347997f87d73c70f194d90c3efb7ddf6f963
      https://github.com/llvm/llvm-project/commit/8384347997f87d73c70f194d90c3efb7ddf6f963
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2022-12-16 (Fri, 16 Dec 2022)

  Changed paths:
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Don't require deduction guides to be templates

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

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D139416




More information about the All-commits mailing list