I have problems with the procedure `magicsAfterOverloadResolution`.

I added a proc to system.nim:
    
    
    proc alignOf*[T](x: T): int {.magic: "AlignOf", noSideEffect.}
    

And ann entry in `magicsAfterOverloadResolution`:
    
    
    of mAlignOf:
        echo "evaluating mAlignOf:"
        let typ = n[1].typ
        debug(typ)
        let align = typ.getAlign
        result = newIntNode(nkIntLit, align)
        result.info = n.info
        debug(result)
    

The output I get is the following:
    
    
    nim c  compiler/nim
    CC: compiler_sem
    bin/nim_temp  c -r testsizeof
    evaluating mAlignOf:
    tyObject SimpleAlignment(null, node: {
        "kind": "nkRecList",
        "info": ["testsizeof.nim", 12, 20],
        "flags": {},
        "sons": [
          {
            "kind": "nkSym",
            "info": ["testsizeof.nim", 13, 4],
            "flags": {},
            "sym": a_104030,
            "typ": tyInt8 int8
          },
          {
            "kind": "nkSym",
            "info": ["testsizeof.nim", 13, 6],
            "flags": {},
            "sym": b_104031,
            "typ": tyInt8 int8
          },
          {
            "kind": "nkSym",
            "info": ["testsizeof.nim", 14, 4],
            "flags": {},
            "sym": c_104032,
            "typ": tyInt64 int64
          }
        ]
      })
    {
      "kind": "nkIntLit",
      "info": ["testsizeof.nim", 111, 51],
      "flags": {},
      "intVal": 8
    }
    testsizeof.nim(111, 52) Error: type mismatch: got (void)
    but expected one of:
    proc `$`(x: int): string
    [...]
    FAILURE
    

the line with the error in testsizeof.nim is the following:
    
    
    echo a.type.name, ":\t", sizeof(a), "\t", alignof(a)
    

where a is of type `SimpleAlignment`
    
    
    type
      SimpleAlignment = object
        a,b: int8
        c: int64
    

Why do I get this error? I create an **integer literal**, and the compiler 
complains that it is of **type void**! 

Reply via email to