[all-commits] [llvm/llvm-project] 6acdf5: [clang] Properly parse variable template requires ...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Fri Mar 17 13:32:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6acdf58919d5e66809555acf5809b12c54ba79dd
      https://github.com/llvm/llvm-project/commit/6acdf58919d5e66809555acf5809b12c54ba79dd
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2023-03-17 (Fri, 17 Mar 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaConcept.cpp
    M clang/test/SemaTemplate/concepts.cpp

  Log Message:
  -----------
  [clang] Properly parse variable template requires clause in lambda

Since P0857, part of C++20, a *lambda-expression* can contain a
*requires-clause* after its *template-parameter-list*.

While support for this was added as part of
eccc734a69c0c012ae3160887b65a535b35ead3e, one specific case isn't
handled properly, where the *requires-clause* consists of an
instantiation of a boolean variable template. This is due to a
diagnostic check which was written with the assumption that a
*requires-clause* can never be followed by a left parenthesis. This
assumption no longer holds for lambdas.

This diagnostic check would then attempt to perform a "recovery", but it
does so in a valid parse state, resulting in an invalid parse state
instead!

This patch adds a special case when parsing requires clauses of lambda
templates, to skip this diagnostic check.

Fixes https://github.com/llvm/llvm-project/issues/61278
Fixes https://github.com/llvm/llvm-project/issues/61387

Reviewed By: erichkeane

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




More information about the All-commits mailing list