[all-commits] [llvm/llvm-project] d87e2e: [Clang] Diagnose `co_await` expressions in default...

Corentin Jabot via All-commits all-commits at lists.llvm.org
Wed Apr 15 07:01:29 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d87e2eadbb124e34537df1e75c73b71dd09a7a30
      https://github.com/llvm/llvm-project/commit/d87e2eadbb124e34537df1e75c73b71dd09a7a30
  Author: Corentin Jabot <corentinjabot at gmail.com>
  Date:   2026-04-15 (Wed, 15 Apr 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/test/SemaCXX/coroutines.cpp

  Log Message:
  -----------
  [Clang] Diagnose `co_await` expressions in default arguments of nested functions (#191817)

co_await/co_yield expressions are not allowed in default arguments. We
were checking they do not appear outside of function contexts, which
include default arguments of the corresponding function, but it missed
default arguments of functions declared in the body of another
functions.

Because parsing default argument isn't done in a dedicated scope, we do
additional checks in `ActOnParamDefaultArgument`. Because the checks is
done in two places, we cannot introduce a more precise diagnostic.

It might be worth considering a parse scope for default arguments in the
future.

Fixes #98923



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list