C++: Add test that shows that IR generation for <=> is broken#20068
C++: Add test that shows that IR generation for <=> is broken#20068jketema merged 2 commits intogithub:mainfrom
<=> is broken#20068Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a test case that demonstrates broken IR (Intermediate Representation) generation for the three-way comparison operator (<=>) in C++20. The test reveals that the IR generation process fails to properly handle spaceship operators, resulting in malformed IR with missing operands and broken control flow.
- Adds test code with C++20 three-way comparison operator usage
- Exposes IR generation bugs through both built-in and custom spaceship operators
- Updates expected test outputs to reflect the broken IR state
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ir.cpp | Adds C++20 test code with std::strong_ordering implementation and spaceship operator usage |
| raw_ir.expected | Shows broken IR generation with incomplete spaceship operator handling |
| raw_consistency.expected | Documents IR consistency errors for spaceship operators |
| aliased_ssa_consistency_unsound.expected | Records SSA consistency issues with spaceship operators |
| aliased_ssa_consistency.expected | Documents aliased SSA consistency problems |
| aliased_ir.expected | Shows incomplete IR generation for spaceship operators |
| PrintAST.expected | Records AST representation of the new test code |
| class ThreeWay { | ||
| int x; | ||
| public: | ||
| std::strong_ordering operator<=>(ThreeWay &y) { return this->x <=> y.x; } |
There was a problem hiding this comment.
This line contains a three-way comparison operator (<=>). According to the coding guidelines, .ql and .qll files should not be reviewed for code logic, but this appears to be a C++ test file (.cpp) so this guideline may not apply. However, the purpose is to demonstrate broken IR generation, so the implementation serves its intended testing purpose.
No description provided.