<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61463>61463</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang crashed when initializing constexpr
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          namniav
      </td>
    </tr>
</table>

<pre>
    Reduced as I can.

**https://gcc.godbolt.org/z/xohcqnqnn**
```c++
#include <string_view>

template<typename T>
consteval std::string_view get_pretty_function_name() {
  return __PRETTY_FUNCTION__;
}

struct probe_config {
  std::string_view prefix;

  consteval probe_config(std::string_view templat, std::string_view probe) {
    auto pos = templat.find(probe);
    if (pos == std::string_view::npos)
      throw "template doesn't contain probe";
    prefix = templat.substr(0, pos);
  }
};

struct struct_probe;
enum enum_probe_t { enum_probe, };

template<auto Val>
struct val_probe_wrapper;


constexpr probe_config struct_probe_config {
  get_pretty_function_name<struct_probe>(),
 "struct_probe"
};

constexpr probe_config enum_probe_config {
 get_pretty_function_name<val_probe_wrapper<enum_probe>>(),
 "enum_probe"
};
```

```c++
<source>:26:24: warning: unused variable 'struct_probe_config' [-Wunused-const-variable]
constexpr probe_config struct_probe_config {
 ^
<source>:31:24: warning: unused variable 'enum_probe_config' [-Wunused-const-variable]
constexpr probe_config enum_probe_config {
 ^
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++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 -Wall -Wextra -O3 <source>
1.      <eof> parser at end of file
 #0 0x0000560c69d2df9f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3a96f9f)
 #1 0x0000560c69d2bfcc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3a94fcc)
 #2 0x0000560c69c7e658 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f04b1b5e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x0000560c6d20ab13 FastEvaluateAsRValue(clang::Expr const*, clang::Expr::EvalResult&, clang::ASTContext const&, bool&) ExprConstant.cpp:0:0
 #5 0x0000560c6d25eaaf clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6fc7aaf)
 #6 0x0000560c6c756335 clang::Sema::PopExpressionEvaluationContext() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64bf335)
 #7 0x0000560c6c1f70c6 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f600c6)
 #8 0x0000560c6ae90285 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4bf9285)
 #9 0x0000560c6a77f361 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x44e8361)
#10 0x0000560c6a701c53 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x446ac53)
#11 0x0000560c6a85f51b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45c851b)
#12 0x0000560c6763910c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x13a210c)
#13 0x0000560c676348cf ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#14 0x0000560c6a55e8dd void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#15 0x0000560c69c7eab7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39e7ab7)
#16 0x0000560c6a55eb1c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#17 0x0000560c6a52622c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x428f22c)
#18 0x0000560c6a526c1d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x428fc1d)
#19 0x0000560c6a53103c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x429a03c)
#20 0x0000560c67636e7f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x139fe7f)
#21 0x0000560c67538945 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12a1945)
#22 0x00007f04b160c083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#23 0x0000560c67630b1e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0x1399b1e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWc1y47gRfhr4gqKKBPh78EEjW8lstnanbGemcmKBICghAwFcAJTlffoU-CMR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