llvm / llvm/llvm-project

Clang-cl fails when std::string_view is propagated as a parameter in an __except filter clause on Windows (SEH).

Open
#188,029 1 comment 0 reactions 0 assignees View on GitHub
clang-cl
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

clang-cl: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.1.5
Target: x86_64-pc-windows-msvc
Thread model: posix

[clang issue.zip](https://github.com/user-attachments/files/26182416/clang.issue.zip)

```c++
// ============================================================================
// PROBLEMATIC VERSION - causes clang to crash during compilation
// ============================================================================
bool ProblematicVersion(std::string_view command)
{
__try
{
return true;
}
__except (SomeExceptionFilter(GetExceptionInformation(), command))
{
return false;
}
}

// ============================================================================
// WORKING VERSION - workaround with std::string_view copy
// ============================================================================
bool WorkingVersion(std::string_view command)
{
std::string_view cpy{command}; // With this copy, clang compiles ok
__try
{

return true;
}
__except (SomeExceptionFilter(GetExceptionInformation(), cpy))
{
return false;
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by extracting clang.issue.zip and compiling the two __try/__except examples with clang-cl 19.1.5 on the stated Windows target, comparing the direct std::string_view parameter with the copy workaround. Trace the crash from this reproducer through the Clang frontend and add coverage showing that the direct form no longer crashes while preserving the workaround’s behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.