[all-commits] [llvm/llvm-project] 3c42e1: Consider aggregate bases when checking if an InitL...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Thu Feb 8 14:27:25 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c42e10afdc518f6d8be5620289ef0da0bf03c5f
      https://github.com/llvm/llvm-project/commit/3c42e10afdc518f6d8be5620289ef0da0bf03c5f
  Author: Reid Kleckner <rnk at google.com>
  Date:   2024-02-08 (Thu, 08 Feb 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/Expr.cpp
    M clang/test/SemaCXX/compound-literal.cpp
    M clang/unittests/AST/ASTExprTest.cpp

  Log Message:
  -----------
  Consider aggregate bases when checking if an InitListExpr is constant (#80519)

This code was correct as written prior to C++17, which allowed bases to
appear in the initializer list.

This was observable by creating non-constant aggregate initialization at
file scope in a compound literal, but since that behavior will change
soon if we implement support for dynamic initialization, I also added a
unit test for `isConstantInitializer`.

This fixes at least one part of issue #80510 .

---------

Co-authored-by: Aaron Ballman <aaron at aaronballman.com>




More information about the All-commits mailing list