v icon indicating copy to clipboard operation
v copied to clipboard

Insufficient type checking on a templated function, when passing a function type

Open flysand7 opened this issue 4 years ago • 0 comments

V version: V 0.2.2 47bf644, timestamp: 2021-07-09 03:27:16 +0300 OS: Linux, Ubuntu 20.04.2 LTS

What did you do?

fn name < T > ( x T ) T
{
  return x + 1
                      }

fn main ( )
{
  println ( name ( name ) ) 
                      }

What did you expect to see?

A type error because function type does (should not) support arithmetic operation.

What did you see instead?

$ v run main.v
Segmentation fault (core dumped)

flysand7 avatar Jul 09 '21 08:07 flysand7