From efce448b239e1ea07d455dfe1a79ae7697b2f71b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 7 Oct 2020 15:50:54 +0300 Subject: [PATCH] parser: always treat MainLetter(x) as a cast, even when the type is not yet known --- vlib/v/parser/parser.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 084657153f..ad46539ca5 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -1041,7 +1041,8 @@ pub fn (mut p Parser) name_expr() ast.Expr { // if name in table.builtin_type_names { if (!known_var && (name in p.table.type_idxs || name_w_mod in p.table.type_idxs) && name !in ['C.stat', 'C.sigaction']) || - is_mod_cast { + is_mod_cast || (!(name.len > 1 && name[0] == `C` && name[1] == `.`) && name[0].is_capital()) { + // MainLetter(x) is *always* a cast, as long as it is not `C.` // TODO handle C.stat() mut to_typ := p.parse_type() if p.is_amp {