<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW " title="NEW --- - Assertion `E != nullptr && "Expected a valid initializer expression"' failed." href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24031&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=vL1i2eXER3tzObcDt3emkTZRjbNR5N0m5DpcSBnH4iw&s=zduRSsZ3vYHsG78NAMaOS2o_UaFgIYaB-TY8FLCFaWE&e=">24031</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion `E != nullptr && "Expected a valid initializer expression"' failed.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stone@cs.hmc.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The simple program
/////////////////////////
template <typename T>
struct MyClass {
MyClass() { outer = new SubClass; };
~MyClass() { delete outer; };
struct SubClass {
SubClass() : inner{} {};
~SubClass() { delete inner; };
SubClass* inner = nullptr;
};
SubClass* outer;
};
int main()
{
MyClass<int> t;
}
//////////////////
fails to compile:
clang:
/mnt/cs/grader/cs70grad/CSTools/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp:2446:
const clang::CXXNewExpr *(anonymous
namespace)::MismatchingNewDeleteDetector::getNewExprFromInitListOrExpr(const
clang::Expr *): Assertion `E != nullptr && "Expected a valid initializer
expression"' failed.
#0 0x2ab8f4a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x2ab8f4a)
#1 0x2aba73b (/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x2aba73b)
#2 0x7f7e550685d0 (/lib64/libpthread.so.0+0x105d0)
#3 0x7f7e54075355 gsignal
/var/tmp/portage/portage/sys-libs/glibc-2.20-r2/work/glibc-2.20/signal/../sysdeps/unix/sysv/linux/raise.c:55:0
#4 0x7f7e540767fd abort
/var/tmp/portage/portage/sys-libs/glibc-2.20-r2/work/glibc-2.20/stdlib/abort.c:91:0
#5 0x7f7e5406e302 __assert_fail_base
/var/tmp/portage/portage/sys-libs/glibc-2.20-r2/work/glibc-2.20/assert/assert.c:53:0
#6 0x7f7e5406e3c2 (/lib64/libc.so.6+0x2e3c2)
#7 0xe87ef2 (/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xe87ef2)
#8 0xe483f8 (/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xe483f8)
#9 0xe479b5 clang::Sema::AnalyzeDeleteExprMismatch(clang::CXXDeleteExpr const*)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xe479b5)
#10 0xe486a4 clang::Sema::ActOnCXXDelete(clang::SourceLocation, bool, bool,
clang::Expr*) (/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xe486a4)
#11 0x1031dd7
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x1031dd7)
#12 0x1041520
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x1041520)
#13 0x1031d4c clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x1031d4c)
#14 0x1063bfb clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x1063bfb)
#15 0x105e380 clang::Sema::PerformPendingInstantiations(bool)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x105e380)
#16 0x1063732 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x1063732)
#17 0x105e380 clang::Sema::PerformPendingInstantiations(bool)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x105e380)
#18 0xc3396d clang::Sema::ActOnEndOfTranslationUnit()
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xc3396d)
#19 0xb79c29
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xb79c29)
#20 0xb75786 clang::ParseAST(clang::Sema&, bool, bool)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0xb75786)
#21 0x765282 clang::FrontendAction::Execute()
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x765282)
#22 0x7343cc clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x7343cc)
#23 0x716cad clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x716cad)
#24 0x70d79f cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x70d79f)
#25 0x71543c main
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x71543c)
#26 0x7f7e54061b75 __libc_start_main
/var/tmp/portage/portage/sys-libs/glibc-2.20-r2/work/glibc-2.20/csu/libc-start.c:323:0
#27 0x70d32d _start
(/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang+0x70d32d)
Stack dump:
0. Program arguments: /mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name bug.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-dwarf-column-info -coverage-file /cs/grader/cs70grad/CSTools/bug.cpp
-resource-dir
/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/../lib/clang/3.7.0
-internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4
-internal-isystem
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4/x86_64-pc-linux-gnu
-internal-isystem
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4/backward
-internal-isystem /usr/local/include -internal-isystem
/mnt/cs/grader/cs70grad/CSTools/llvm-install/bin/../lib/clang/3.7.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/cs/grader/cs70grad/CSTools -ferror-limit 19 -fmessage-length 209
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o bug.o -x c++ bug.cpp
1. <eof> parser at end of file
2. bug.cpp:5:5: instantiating function definition '~MyClass'
3. bug.cpp:11:13: instantiating function definition '~SubClass'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (trunk 241395)
Target: x86_64-unknown-linux-gnu
Thread model: posix</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>