<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 - Segfault when parsing use of static data member template with deduced type dependent on class template template parameter"
   href="https://bugs.llvm.org/show_bug.cgi?id=42372">42372</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segfault when parsing use of static data member template with deduced type dependent on class template template parameter
          </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>All
          </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>eracpp@eml.cc
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following example (<a href="https://gcc.godbolt.org/z/lrNU6I">https://gcc.godbolt.org/z/lrNU6I</a>):

template <typename> int C = 0;

template <template <typename> typename T>
struct S
{
    template <typename U>
    static auto const X = C<T<U>>;

    int x = X<void>;
};

Produces a stack dump (omitted program arguments flags due to verbosity; see
the Compiler Explorer link above for full message):

Stack dump:
0.      Program arguments: ...
1.      <eof> parser at end of file
2.      <source>:4:1: parsing struct/union/class body 'S'
#0 0x000055eb13de3c4a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20190624/bin/clang-9+0x2754c4a)
#1 0x000055eb13de1a14 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk-20190624/bin/clang-9+0x2752a14)
#2 0x000055eb13de1b52 SignalHandler(int)
(/opt/compiler-explorer/clang-trunk-20190624/bin/clang-9+0x2752b52)
#3 0x00007ff38b971890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
clang-9: error: unable to execute command: Segmentation fault (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
Compiler returned: 254

The type of the static data member must be deduced (e.g. replacing `auto` with
`int` avoids the segfault; `decltype(auto)` also works in place of `auto`). The
static data member must be used (`X<void>`) to induce the segfault (e.g.
removing `int x = X<void>;` avoids the segfault).</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>