diff --git a/source/parsing/Parser_members.cpp b/source/parsing/Parser_members.cpp index 8329c80b7..221bcb534 100644 --- a/source/parsing/Parser_members.cpp +++ b/source/parsing/Parser_members.cpp @@ -2090,8 +2090,10 @@ DPIImportSyntax& Parser::parseDPIImport(AttrList attributes) { equals = expect(TokenKind::Equals); } - auto& method = parseFunctionPrototype(SyntaxKind::Unknown, FunctionOptions::AllowEmptyArgNames | - FunctionOptions::IsPrototype); + auto& method = parseFunctionPrototype(SyntaxKind::Unknown, + FunctionOptions::AllowEmptyArgNames | + FunctionOptions::AllowImplicitReturn | + FunctionOptions::IsPrototype); if (property.kind == TokenKind::PureKeyword && method.keyword.kind == TokenKind::TaskKeyword) addDiag(diag::DPIPureTask, method.keyword.range()) << property.range(); diff --git a/tests/unittests/parsing/MemberParsingTests.cpp b/tests/unittests/parsing/MemberParsingTests.cpp index a478bc6e6..38327e94e 100644 --- a/tests/unittests/parsing/MemberParsingTests.cpp +++ b/tests/unittests/parsing/MemberParsingTests.cpp @@ -1164,3 +1164,12 @@ import "DPI-C" pure task bad_pure_dpi_t (logic [3:0] a); REQUIRE(diagnostics.size() == 1); CHECK(diagnostics[0].code == diag::DPIPureTask); } + +TEST_CASE("DPI implicit return parsing") { + auto& text = R"( +import "DPI-C" function dpi_f (logic [3:0] a); +)"; + + parseCompilationUnit(text); + CHECK_DIAGNOSTICS_EMPTY; +}