<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - dynamic_cast to virtual base with multiple access control"
   href="https://bugs.llvm.org/show_bug.cgi?id=35462">35462</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>dynamic_cast to virtual base with multiple access control
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>stephane.zimmermann@trust-in-soft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code:

struct Foo {
    int x = 42;
    virtual void f() {}
};

struct PublicBar: public virtual Foo { };
struct PrivateBar: private virtual Foo { };

struct EntryPoint {
    virtual void g() {}
};

struct Baz: PublicBar, PrivateBar, EntryPoint {};

int main(void) {
    Baz b;
    EntryPoint *e = &b;
    Foo *f = dynamic_cast<Foo *>(e);
    return f->x;
}

when compiled and executed causes a segmentation fault because the dynamic_cast
is failing.

The dynamic cast should not fail, as the Foo base is unique because it is
virtual and is accessible because of the path PublicBar::Foo.</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>