<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 - Crash when expanding an empty fold expression"
   href="https://bugs.llvm.org/show_bug.cgi?id=41845">41845</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash when expanding an empty fold expression
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ryan.brown@ableton.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21932" name="attach_21932" title="Crash Log">attachment 21932</a> <a href="attachment.cgi?id=21932&action=edit" title="Crash Log">[details]</a></span>
Crash Log

See <a href="https://godbolt.org/z/QJQ4A7">https://godbolt.org/z/QJQ4A7</a>.

#include <tuple>
#include <type_traits>
#include <utility>

template <typename... DstArgs>
struct ArgsPackChecker
{
  template <typename... SrcArgs>
  using EnableIf = std::enable_if_t<
    (std::is_convertible_v<SrcArgs, DstArgs> && ...)>;
};

template <typename DstArgsTuple,
          typename IndexSeq =
std::make_index_sequence<std::tuple_size_v<DstArgsTuple>>>
struct ArgsChecker;

template <typename DstArgsTuple, int... Is>
struct ArgsChecker<DstArgsTuple, std::index_sequence<Is...>>
{
  template <typename... SrcArgs>
  using EnableIf =
    typename ArgsPackChecker<std::tuple_element_t<Is,
DstArgsTuple>...>::template EnableIf<SrcArgs...>;
};

template <typename... Args,
          typename = typename ArgsChecker<std::tuple<>>::template
EnableIf<Args...>>
void f(Args&&... args)
{
}

This builds without an error with GCC 9.1, but crashes with clang trunk. The
attached crash backtrace was generated using Xcode 10.2.1 using the following
command:

$ clang -std=c++17 test.cpp
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://developer.apple.com/bugreporter/">http://developer.apple.com/bugreporter/</a> and include the crash backtrace,
preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg:
/var/folders/v1/0ffrrhw11394l1p_rl193z340000gn/T/test-87fcfd.cpp
clang: note: diagnostic msg:
/var/folders/v1/0ffrrhw11394l1p_rl193z340000gn/T/test-87fcfd.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg:
/Users/ryan/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your
crash)
clang: note: diagnostic msg: 

********************</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>