<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 --- - Requesting an additional diagnostic note on invalid casts"
   href="https://llvm.org/bugs/show_bug.cgi?id=26722">26722</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Requesting an additional diagnostic note on invalid casts
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Yunzhong_Gao@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have the following two test cases.

//------ test1.cc
class base {
    virtual void func() { }
};

class Derived;

void test(Derived *x) {
    base *y = x; // error here about invalid cast
}
//------ end test1.cc


//------ test2.cc
class base {
    virtual void func() { }
};

class Derived { };

void test(Derived *x) {
    base *y = x; // error here about invalid cast
}
//------ end test2.cc

When I compile with clang, I get the same error for both test cases:
error: cannot initialize a variable of type 'base *' with an lvalue of type
'Derived *'


This is a feature request for an additional note that differentiates the
two test cases. For example, maybe

for the first test case,
note: class type 'Derived' is incomplete

And for the second test case,
note: class type 'Derived' is not inheriting from class type 'base'


If I try the same test case on the online compiler at ideone.com, I would
get the note as I described for the first test case.</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>