From a2725fd03febf32051811af2fa50fd0de3b61dde Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 6 May 2021 16:08:15 -0700 Subject: Fix for uninitialized field (#1838) The `OverloadedExpr` type didn't provide a default value for its field: Name* name; This led to a null-pointer crash in the logic that deals with synthesizing interface requirements because it creates an `OverloadedExpr` but doesn't initialize the field. This change makes two fixes: 1. The logic in the synthesis path actually initializes `name` so that it can feed into any downstream error messages 2. The `OverloadedExpr` declaration now includes an initial value for `name` so that it will at least be null instead of garbage if we slip up again --- source/slang/slang-check-decl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 726781fb0..0f6075903 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -2062,6 +2062,7 @@ namespace Slang // expression. // auto synBase = m_astBuilder->create(); + synBase->name = requiredMemberDeclRef.getDecl()->getName(); synBase->lookupResult2 = lookupResult; // If `synThis` is non-null, then we will use it as the base of -- cgit v1.2.3