Skip to content

Commit

Permalink
Fixes a segmentation fault for unnamed declarations.
Browse files Browse the repository at this point in the history
An example is:
```
func: (t: int, f) = {
  f(t + 2);
}

main: () = {
  x: int = 4;

  // :(v) = ... causes the error.
  func(x, :(v) = std::cout << "Value: " << v << std::endl);
}
```
  • Loading branch information
MaxSagebaum committed Jan 3, 2025
1 parent ad8a163 commit 8f55343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/diagnostics.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace cpp2 {
std::string result = {};
auto parent = decl->get_parent();

while(parent != nullptr) {
while(parent != nullptr && parent->identifier != nullptr) {
result = parent->identifier->to_string() + dot(result) + result;
parent = parent->get_parent();
}
Expand Down

0 comments on commit 8f55343

Please sign in to comment.