[all-commits] [llvm/llvm-project] 924acb: [clang] Prevent folding of non-const compound expr

serge-sans-paille via All-commits all-commits at lists.llvm.org
Sun May 15 22:53:37 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 924acb624f58030652ecc8c07db313fde0f31395
      https://github.com/llvm/llvm-project/commit/924acb624f58030652ecc8c07db313fde0f31395
  Author: serge-sans-paille <sguelton at redhat.com>
  Date:   2022-05-16 (Mon, 16 May 2022)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp
    M clang/test/SemaTemplate/constexpr-instantiate.cpp

  Log Message:
  -----------
  [clang] Prevent folding of non-const compound expr

When a non-const compound statement is used to initialize a constexpr pointer,
the pointed value is not const itself and cannot be folded at codegen time.

This matches GCC behavior for compound literal expr arrays.

Fix issue #39324.

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




More information about the All-commits mailing list