CodeGen: ensure placeholder instruction for cleanup is created
A placeholder instruction for use in generation of cleanup code for an initializer list would not be emitted if the base class contained a non-trivial destructor and the class contains no fields of its own. This would be the case when using CTAD to deduce the template arguments for a struct with an overloaded call operator, e.g. ``` template <class... Ts> struct ctad : Ts... {}; template <class... Ts> ctad(Ts...)->ctad<Ts...>; ``` and this class was initialized with a list of lambdas capturing by copy, e.g. ``` ctad c {[s](short){}, [s](long){}}; ``` In a release build the bug would manifest itself as a crash in the SROA pass, however, in a debug build the following assert in CGCleanup.cpp would fail: ``` assert(dominatingIP && "no existing variable and no dominating IP!"); ``` By ensuring that a placeholder instruction is emitted even if there's no fields in the class, neither the assert nor the crash is reproducible. See https://bugs.llvm.org/show_bug.cgi?id=40771 Patch by Øystein Dale! llvm-svn: 367042
Loading
Please register or sign in to comment