<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 - Segmentation fault when expanding C++ 11 template"
   href="https://bugs.llvm.org/show_bug.cgi?id=44363">44363</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault when expanding C++ 11 template
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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++14
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>evandrocoan@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was just building some simple template code and the clang compiler crashed.

It crashes both with clang 5 (windows release) and 8 (cygwin release).

This is the command line output from clang 5 and 8, plus the source code:


Professional@PROFESSIONAL-PC$ whereis clang
clang: /usr/bin/clang /usr/lib/clang /cygdrive/c/Program
Files/LLVM/bin/clang.exe /usr/share/man/man1/clang.1.gz


$ clang++ -Xclang -ast-print -fsyntax-only test_debugger.cpp > main.exe
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix
InstalledDir: /usr/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to  and include the
crash backtrace, preprocessed source, and associated run script.
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: note: diagnostic msg: Error generating preprocessed source(s).


$ /cygdrive/c/Program\ Files/LLVM/bin/clang.exe -Xclang -ast-print
-fsyntax-only test_debugger.cpp > main.exe
Wrote crash dump file
"C:\Users\PROFES~1\AppData\Local\Temp\clang.exe-2c8cc4.dmp"
clang.exe: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
clang.exe: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang.exe: note: diagnostic msg: Error generating preprocessed source(s).


Source code:
#include <array>
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)

template< unsigned int PathIndex, unsigned int PathLength >
constexpr unsigned int findlastslash(const char (&path)[PathLength])
{
    constexpr const unsigned int end = PathLength - PathIndex;
    return (end >= 0 && path[end] != '/' && path[end] != '\\') ? findlastslash<
PathIndex - 1 >( path ) : ( end + 1 );
}

int main(int argc, char const *argv[])
{
    STATIC_ASSERT( findlastslash< 1 >( "cppdebugger/test_debugger.cpp" ) == 17
);
}</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>