<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 --- - Clang has pretty catastrophic failure of error recovery when a method's signature has an invalid type"
   href="https://llvm.org/bugs/show_bug.cgi?id=31110">31110</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang has pretty catastrophic failure of error recovery when a method's signature has an invalid type
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>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>chandlerc@gmail.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>Consider this test case:
----
template<typename T> struct S {
  S() {}
  ~S() {}
  void foobar(U mumble) {}
};

class Base {
  S<int> dummy;
  int i;

public:
  virtual ~Base() {}
};

struct Derived : Base {
  virtual void method() {}
};

void test() {
  Derived d;

  Base *b = &d;
}
----

Clang, all the way back to 3.2, has really bad recovery for numerous cases like
this. At the very least:

1) Just because the member function is invalid, we mark all of the
instantiations of the class template invalid. This might be OK if doing that
effectively suppressed subsequent errors on that invalid class and we bailed
out of instantiation. But neither seems to be true.

2) In the face of an invalid member of a base class with a virtual destructor,
we manage to leave things in a state where essentially all of the errors and
warnings specific to the base <-> derived relationship are bogus.

The above test case only triggers this once, but in many cases, the above leads
a single root cause error to produce *hundreds* of diagnostics that have
literally nothing to do with anything connected to the class template that was
invalid.</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>