| Issue |
165039
|
| Summary |
[Clang 22][ICE] "cannot compile this l-value _expression_ yet" when using std::array inside consteval lambda
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
Prevter
|
Code below compiles successfully on Clang 21 and GCC, but crashes on the current trunk build available on Compiler Explorer.
Godbolt link: https://godbolt.org/z/svb3faqoP
```cpp
#include <array>
#include <cstddef>
#include <tuple>
#include <utility>
template <int V>
struct Tag {};
template <class... Ts>
struct Wrapper {
constexpr Wrapper(std::tuple<Ts...>) {}
};
template <size_t N, std::array<int, N> A>
consteval auto make_tuple() {
return []<size_t... I>(std::index_sequence<I...>) {
return std::tuple<Tag<A[I]>...>{};
}(std::make_index_sequence<N>{});
}
template <size_t N, std::array<int, N> A>
using Alias = decltype(Wrapper{ make_tuple<N, A>() });
template <class>
constexpr int bar() { return 1; }
template <std::array A>
constexpr int foo() {
// "error: cannot compile this l-value _expression_ yet":
return bar<Alias<A.size(), A>>();
}
int main() {
constexpr std::array data = ""
return foo<data>();
}
```
Compiler output:
```
<source>:30:12: error: cannot compile this l-value _expression_ yet
30 | return bar<Alias<A.size(), A>>();
| ^~~~~~~~~~~~~~~~~~~~~~~
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 -std=c++20 <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:28:15: Generating code for declaration 'foo'
#0 0x0000000003cecc38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cecc38)
#1 0x0000000003cea60c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cea60c)
#2 0x0000000003c30708 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x0000762349042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000000034f4c520
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs