<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 - Clang++ parser segfault on a small file g++ compiles just fine"
   href="https://bugs.llvm.org/show_bug.cgi?id=52498">52498</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang++ parser segfault on a small file g++ compiles just fine
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>13.0
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>camille.brugel@laposte.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25448" name="attach_25448" title="TAR archive containing the preprocessed cpp, the full clang++ invocation in a shell script, and the original file">attachment 25448</a> <a href="attachment.cgi?id=25448&action=edit" title="TAR archive containing the preprocessed cpp, the full clang++ invocation in a shell script, and the original file">[details]</a></span>
TAR archive containing the preprocessed cpp, the full clang++ invocation in a
shell script, and the original file

Hello,

This is going to sound ironic but I discovered this bug while refactoring the
AST of my (not yet working) compiler. It is quite generic (using template
template parameters) but g++ is able to compile it. I can reproduce it in a
small file (see attachment).

guest@eb0013e54f13:/home/cbrugel/workspace/C++/dmit$ clang++ --version
Ubuntu clang version
13.0.1-++20211029101849+08e3a5ccd952-1~exp1~20211029222435.16
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

`clang++ --std=c++20 segfault.cpp` produces a segfault in the parser.

The code I was refactoring (which does compile with clang++):

<a href="https://github.com/matovitch/dmit/blob/96d666a48c4a3ae2083cdad5b415851df61f132a/lib/include/dmit/ast/node.hpp">https://github.com/matovitch/dmit/blob/96d666a48c4a3ae2083cdad5b415851df61f132a/lib/include/dmit/ast/node.hpp</a>

Let me know if you need some more information.

Best Regards,

Camille BRUGEL</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>