Delay struct type determination until elaboration

This commit is contained in:
Wilson Snyder 2024-09-21 20:27:55 -04:00
parent 5f39c69d19
commit 888af29a72
4 changed files with 37 additions and 1 deletions

View File

@ -2212,7 +2212,7 @@ data_typeVirtual<nodeDTypep>: // ==IEEE: data_type after yVIRTUAL [ yI
;
data_type_or_void<nodeDTypep>: // ==IEEE: data_type_or_void
data_type { $$ = $1; }
data_typeAny { $$ = $1; }
| yVOID
{ $$ = new AstBasicDType{$1, LOGIC_IMPLICIT};
BBUNSUP($1, "Unsupported: void (for tagged unions)"); }

View File

@ -0,0 +1,4 @@
%Error: t/t_struct_type_bad.v:13:7: Expecting a data type: 'i'
13 | i badi;
| ^
%Error: Exiting due to

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('linter')
test.lint(fails=True, expect_filename=test.golden_filename)
test.passes()

View File

@ -0,0 +1,16 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2012 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
int i;
typedef struct packed {
int i;
i badi; // Bad
} struct_t;
endmodule