Allow any data type in primary expression

There are a few system functions that take either an expression or a data
type. This is implemented in the parser by allowing a type identifier as a
primary expression.

But those functions allow any data type, not just typedefs. E.g.

```
$bits(int);
$bits(reg [1:0]);
$bits(struct packed { int x; });
```

Support this by changing the parser rule from TYPE_IDENTIFIER to data_type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-02-06 18:24:24 +01:00
parent 771d02bee1
commit c76db2867c
1 changed files with 3 additions and 5 deletions

View File

@ -3760,12 +3760,10 @@ expr_primary_or_typename
/* There are a few special cases (notably $bits argument) where the
expression may be a type name. Let the elaborator sort this out. */
| TYPE_IDENTIFIER
{ pform_set_type_referenced(@1, $1.text);
PETypename*tmp = new PETypename($1.type);
FILE_NAME(tmp,@1);
| data_type
{ PETypename*tmp = new PETypename($1);
FILE_NAME(tmp, @1);
$$ = tmp;
delete[]$1.text;
}
;