<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 - ICE: passing the result of a consteval function to another consteval function is crashing Clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=52353">52353</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ICE: passing the result of a consteval function to another consteval function is crashing Clang
          </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>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++2a
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>heavenandhell171@gmail.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>=== version
$ clang++.exe --version
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
abdb82b237ebf42572c5730a2265bfc98fc8b0c4)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Dev\LLVM\bin

=== repro
$ type ice.cpp
template <typename T>
struct type_t {};

template <typename...>
struct list_t {};

template <typename T, typename... Ts>
consteval auto pop_front(list_t<T, Ts...>) -> auto {
  return list_t<Ts...>{};
}

template <typename... Ts, typename F>
consteval auto apply(list_t<Ts...>, F fn) -> auto {
  return fn(type_t<Ts>{}...);
}

void test() {
  apply(
      pop_front(list_t<char, char>{}),
      []<typename... Us>(type_t<Us>...) {
        return false;
      });
}

$ clang++.exe -std=c++20 ice.cpp
ice.cpp:18:3: warning: expression result unused [-Wunused-value]
  apply(
  ^~~~~~
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run scri
pt.
Stack dump:
0.      Program arguments: C:\\Dev\\LLVM\\bin\\clang++.exe -cc1 -triple
x86_64-pc-windows-msvc19.29.30037 -emit-obj -mrelax-all -m
incremental-linker-compatible --mrelax-relocations -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name ice.c
pp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno
-fno-rounding-math -mconstructor-aliases -funwind-tables=
2 -target-cpu x86-64 -tune-cpu generic
-fcoverage-compilation-dir=C:\\Users\\IVAN\\Desktop\\peg\\build -resource-dir
C:\\Dev\\LLVM
\\lib\\clang\\14.0.0 -internal-isystem
C:\\Dev\\LLVM\\lib\\clang\\14.0.0\\include -internal-isystem "C:\\Program Files
(x86)\\Micr
osoft Visual Studio 2019\\VC\\Tools\\MSVC\\14.29.30037\\ATLMFC\\include"
-internal-isystem "C:\\Program Files (x86)\\Microsoft Vis
ual Studio 2019\\VC\\Tools\\MSVC\\14.29.30037\\include" -internal-isystem
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.
0.19041.0\\ucrt" -internal-isystem "C:\\Program Files (x86)\\Windows
Kits\\10\\include\\10.0.19041.0\\shared" -internal-isystem "C
:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\um"
-internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\
\include\\10.0.19041.0\\winrt" -internal-isystem "C:\\Program Files
(x86)\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt" -std
=c++20 -fdeprecated-macro
-fdebug-compilation-dir=C:\\Users\\IVAN\\Desktop\\peg\\build -ferror-limit 19
-fmessage-length=130 -fno-
use-cxa-atexit -fms-extensions -fms-compatibility
-fms-compatibility-version=19.29.30037 -fdelayed-template-parsing
-fno-implicit-
modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -o
C:\\Users\\IVAN\\AppData\\Local\\Temp\\ice-1a857b.o -x c++
ice.cpp
1.      <eof> parser at end of file
2.      ice.cpp:17:13: parsing function body 'test'
0x00007FF65B2A6AFA (0x0000000000000000 0x0000000000000000 0x0000000000000068
0x0000000000000000)
0x00007FF65B27D237 (0x0000003ABCD8B890 0x00000191E1C45940 0x00000191E1C45940
0x00007FF65CABE420)
0x00007FF65B278925 (0x00008A62DA3A4C5B 0x00000191E1BE2140 0x0000000000000100
0x0000000000000000)
0x00007FF65B2784F1 (0x00008A62DA3A4401 0x00007FF600000000 0x0000000000000100
0x00000191E1BECD10)
0x00007FF65B8CEEF3 (0x00000000000001CA 0x0000000000000154 0x0000003ABCD8C4D0
0x0000000000000154)
0x00007FF65B59C379 (0x0000003ABCD8C508 0x0000003ABCD8C5E0 0x0000003ABCD8C5D0
0x00007FF65B599465)
0x00007FF65C78CDBE (0x0000019100000000 0x0000000000000000 0x0000003ABCD8D101
0x00000191E1B35810)
0x00007FF65C4493D9 (0x0000003ABCD8D10A 0x0000003ABCD8D2E0 0x0000003ABCD8D0F8
0x00007FF65C70DDF1)
0x00007FF65C74165D (0x00000191E1B7FCD0 0x00007FF659E04600 0x0000003ABCD8D2B0
0x00000191E1C300A0)
0x00007FF65C4484BC (0x00000191E1B73C30 0x00007FF65AA0DC83 0x00000191E1C32D40
0x0000000000000008)
0x00007FF65C447E9C (0x00007FF600000028 0x0000000000000009 0x00007FF65D3554F9
0x0000000100000009)
0x00007FF65C446A31 (0x00000191E1C3B780 0x00008A62DA3A2FDB 0x00000191E1C3B780
0x00000191E1C3B780)
0x00007FF65C44498B (0x0000003ABCD8DA18 0x0000003ABCD8DA08 0x0000003ABCD8DA08
0x00007FF659DF696A)
0x00007FF65BA4C11E (0x00007FF65D400800 0x00008A62DA3A2DDB 0x2D646E756F72522D
0x3163632D70697274)
0x00007FF65AADA092 (0x00000191E1AF5D30 0x00000191E1AF7C30 0x00000191E1B65B60
0x00007FF659E881A9)
0x00007FF659DF896D (0x00000191E1AF8840 0x00000191E1B65B60 0x00000191E1B669F0
0x00000191E1B356F0)
0x00007FF659E888BE (0x00000191E1B1DC90 0x0000003ABCD8DE50 0x00000191E1B35FD0
0x00007FFDF50000F5)
0x00007FF659827B8A (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FF659824A2F (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FF659824832 (0x0000000000000000 0x00007FF65CA97859 0x0000000000000000
0x0000000000000000)
0x00007FF65CA977E0 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FFD64947BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), BaseThreadInitThunk() + 0x14 byt
es(s)
0x00007FFD6590CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), RtlUserThreadStart() + 0x21 byte
s(s)
clang++: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
abdb82b237ebf42572c5730a2265bfc98fc8b0c4)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Dev\LLVM\bin
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: C:\Users\IVAN\AppData\Local\Temp\ice-f711d4.cpp
clang++: note: diagnostic msg: C:\Users\IVAN\AppData\Local\Temp\ice-f711d4.sh
clang++: note: diagnostic msg:

********************

=== notes

If I replace pop_front(list_t<char, char>{}) by list_t<char>{} directly, it
works as expected.</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>