Skip to content

template/macro pragmas don't work in templates (eg: byaddr, since etc) #15920

Closed
@Clonkk

Description

@Clonkk

Using byaddrin a template does not compile while the same code inside a block works.

Example

import std/decls

template test(x: string)=
  var y {.byaddr.} = x
  echo y
 
var xx = "123"
test(xx)

Current Output

 template/generic instantiation of `test` from here
 Error: invalid pragma: byaddr

Expected Output

123

$ nim -v

Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2020-11-11
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: bbe49a14ae827b6474d692042406716a3b3dd71f
active boot switches: -d:release

[EDIT]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions