<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 - Error recovery loses type inheritance relationship?"
   href="https://bugs.llvm.org/show_bug.cgi?id=33919">33919</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error recovery loses type inheritance relationship?
          </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>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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jmgao@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Minimized test case:

    namespace ns {
      typedef int type;
    }

    struct base {
    };

    struct derived : public base {
      ns:;type foo() { return 0; }
    };

    int foo(base& b) {
      return 0;
    }

    int main() {
      derived x;
      foo(x);
    }

Clang (r4053586) is smart enough to notice that I probably meant ns::type:

    test.cpp:9:3: error: unknown type name 'ns'
      ns:;type foo() { return 0; }
      ^
    test.cpp:9:6: error: expected expression
      ns:;type foo() { return 0; }
         ^
    test.cpp:9:7: error: unknown type name 'type'; did you mean 'ns::type'?
      ns:;type foo() { return 0; }
          ^~~~
          ns::type
    test.cpp:2:15: note: 'ns::type' declared here
      typedef int type;
              ^

but seems to have forgotten the relationship between base and derived?

    test.cpp:18:3: error: no matching function for call to 'foo'
      foo(x);
      ^~~
    test.cpp:12:5: note: candidate function not viable: no known conversion
                         from 'derived' to 'base &' for 1st argument
    int foo(base& b) {


The actual code that this was minimized from triggered a pretty catastrophic
failure, because the type in which this typo happened inherited a type which
had an overload for std::ostream operator <<, resulting in a helpful 111-line
list of every overload of std::ostream operator <<, per use of <<.</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>