From deb79f8e7f6a065a9027070265fc18ae74f0ce4c Mon Sep 17 00:00:00 2001 From: Max Sagebaum Date: Thu, 2 Jan 2025 09:11:28 +0100 Subject: [PATCH] Fixes a segmentation fault for unnamed declarations. 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); } ``` --- source/diagnostics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/diagnostics.h b/source/diagnostics.h index 0048b49043..67ba05c2dd 100644 --- a/source/diagnostics.h +++ b/source/diagnostics.h @@ -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(); }