[all-commits] [llvm/llvm-project] c30b28: [clang] fix error recovery ICE on copy elision whe...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Tue Sep 7 10:45:55 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: c30b2813a1d522eb9adeec2d73b1e79a8020c998
      https://github.com/llvm/llvm-project/commit/c30b2813a1d522eb9adeec2d73b1e79a8020c998
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2021-09-07 (Tue, 07 Sep 2021)

  Changed paths:
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

  Log Message:
  -----------
  [clang] fix error recovery ICE on copy elision when returing invalid variable

See PR51708.

Attempting copy elision in dependent contexts with invalid variable,
such as a variable with incomplete type, would cause a crash when attempting
to calculate it's alignment.

The fix is to just skip this optimization on invalid VarDecl, as otherwise this
provides no benefit to error recovery: This functionality does not try to
diagnose anything, it only calculates a flag which will affect where the
variable will be allocated during codegen.

Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>

Reviewed By: rtrieu

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

(cherry picked from commit d98c34f4d7950f531661ba3f498222ccf6239a0f)




More information about the All-commits mailing list