<html>
    <head>
      <base href="http://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 --- - Parser crash on typo-corrected code"
   href="http://llvm.org/bugs/show_bug.cgi?id=22672">22672</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Parser crash on typo-corrected code
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </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>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>matt.giuca@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13932" name="attach_13932" title="Output / crash backtrace">attachment 13932</a> <a href="attachment.cgi?id=13932&action=edit" title="Output / crash backtrace">[details]</a></span>
Output / crash backtrace

Clang++ crashed while attempting to fix up a typo. I managed to reduce it down
to a minimal reproduction example:

class MyClass {
 public:
  void foo();
  int bar();
};

class Main {
 public:
  MyClass* myfield() const;
  void MyMethod();
};

void Main::MyMethod() {
  myfield_->foo();
  int x = myfield_->bar();
}

It tries to rename myfield_ ("use of undeclared identifier 'myfield_'; did you
mean 'myfield'?") to myfield, and then tries to turn that into a method call
("reference to non-static member function must be called; did you mean to call
it with no arguments?"). Then it crashes in the parser.

The crash seems to require both of the above automatic rewrites, as well as two
calls to myfield_ methods, the latter of which must be assigned to a variable.
If I simplify the example further, the crash goes away.

Note that I am using the version of Clang which is set up by the Chromium
project (I am not sure if it has been modified), but that I have removed all of
the Chromium-specific compiler flags (this example repros when compiled without
any arguments).

clang version 3.6.0 (trunk 223108)
Target: x86_64-unknown-linux-gnu
Thread model: posix

The same code, compiled with "Ubuntu clang version 3.4-1ubuntu3", does not
crash the compiler (it just gives the appropriate parse errors and terminates).</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>