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: unassignedclangb...@nondot.org
          Reporter: t.p.northo...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to