[all-commits] [llvm/llvm-project] 8a4d38: [Clang][Sema] Prohibit statement expression in the...

Jun Zhang via All-commits all-commits at lists.llvm.org
Tue Apr 5 18:29:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a4d388c7fa47fa50076babecc38757009dbc987
      https://github.com/llvm/llvm-project/commit/8a4d388c7fa47fa50076babecc38757009dbc987
  Author: Jun Zhang <jun at junz.org>
  Date:   2022-04-06 (Wed, 06 Apr 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseTemplate.cpp
    A clang/test/Sema/stmt-expr-in-default-arg.cpp
    M clang/test/SemaTemplate/dependent-expr.cpp

  Log Message:
  -----------
  [Clang][Sema] Prohibit statement expression in the default argument

As statement expression makes no sense in the default argument,
this patch tries to disable it in the all cases.

Please note that the statement expression is a GNU extension, which
means that Clang should be consistent with GCC. However, there's no
response from GCC devs since we have raised the issue for several weeks.
In this case, I think we can disallow statement expressions as a default
parameter in general for now, and relax the restriction if GCC folks
decide to retain the feature for functions but not lambdas in the
future.

Related discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104765

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

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




More information about the All-commits mailing list