<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 - assert in lib/Sema/SemaExpr.cpp triggers"
   href="https://bugs.llvm.org/show_bug.cgi?id=34420">34420</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>assert in lib/Sema/SemaExpr.cpp triggers
          </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>All
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>doj@cubic.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was running the clang-tidy program on my company's source code and it was
always triggering an assert() in lib/Sema/SemaExpr.cpp
Sema::PerformObjectMemberConversion() I have changed the assert() to return an
error status, this made clang-tidy run for me, but it is probably not the
correct solution. See the following patch:

Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp       (revision 311486)
+++ lib/Sema/SemaExpr.cpp       (working copy)
@@ -2611,7 +2611,10 @@
     // We only need to do this if the naming-class to declaring-class
     // conversion is non-trivial.
     if (!Context.hasSameUnqualifiedType(FromRecordType, URecordType)) {
-      assert(IsDerivedFrom(FromLoc, FromRecordType, URecordType));
+      // doj: fails for my code
+      if (! IsDerivedFrom(FromLoc, FromRecordType, URecordType))
+        return ExprError();
+
       CXXCastPath BasePath;
       if (CheckDerivedToBaseConversion(FromRecordType, URecordType,
                                        FromLoc, FromRange, &BasePath))

This is my first adventure with llvm and clang. How can I better fix this? The
assert is of course triggered when parsing a large and ugly source code file,
that may not be easy for me to reduce to the expression that triggers the
assert.</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>