Skip to content

Commit

Permalink
Fix crash when adding drivers for selecting result of function call
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Jun 22, 2022
1 parent 2d346ce commit 8866ee6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/symbols/ValueSymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ValueSymbol::Driver& ValueSymbol::Driver::create(EvalContext& evalContext, Drive
switch (expr->kind) {
case ExpressionKind::NamedValue:
case ExpressionKind::HierarchicalValue:
case ExpressionKind::Call:
expr = nullptr;
break;
case ExpressionKind::Conversion:
Expand Down
20 changes: 20 additions & 0 deletions tests/unittests/ClassTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2566,3 +2566,23 @@ endfunction
REQUIRE(diags.size() == 1);
CHECK(diags[0].code == diag::Redefinition);
}

TEST_CASE("Class method driver crash regress GH #552") {
auto tree = SyntaxTree::fromText(R"(
class B;
int v[$];
endclass
class C;
virtual function B get();
endfunction
function f();
get().v.delete();
endfunction
endclass
)");

Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}

0 comments on commit 8866ee6

Please sign in to comment.