[llvm-bugs] [Bug 33158] New: Constant expression cast to virtual base crashes
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 24 11:05:07 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33158
Bug ID: 33158
Summary: Constant expression cast to virtual base crashes
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: t.p.northover at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
When trying to compile this code:
struct A {};
struct B : public virtual A {}; // Single virtual base.
void foo() {
static_cast<A&>(*(B*)0);
}
Clang crashes interpreting that final static_cast. I'm still unsure why. The
immediate cause is that we're peering into an empty SubobjectDesignator, but
I'm suspicious about PointerExprEvaluator::ZeroInitialization. It seems to
completely ignore the Expr's type when filling out the Result.
This came up in a couple of tests when switching the default compilation mode
to C++14, though this particular reduced example fails in all modes.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170524/48258ea2/attachment.html>
More information about the llvm-bugs
mailing list