summary refs log tree commit diff stats
path: root/tests/ccgbugs/tforward_decl_only.nim
blob: 74fbae303decde238243a60804a46af65bb7bc83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
discard """
ccodecheck: "\\i !@('struct tyObject_MyRefObject'[0-z]+' {')"
ccodecheck: "\\i !@('mymoduleInit')"
ccodecheck: "\\i @('mymoduleDatInit')"
output: "hello"
"""

# issue #7339 
# Test that MyRefObject is only forward declared as it used only by reference

import mymodule
type AnotherType = object
  f: MyRefObject 

let x = AnotherType(f: newMyRefObject("hello"))
echo $x.f


# bug #7363

type 
  Foo = object
    a: cint
  Foo2 = object
    b: cint

proc f(foo: ptr Foo, foo2: ptr Foo2): cint =
  if foo  != nil:  {.emit: "`result` = `foo`->a;".}
  if foo2 != nil: {.emit: [result, " = ", foo2[], ".b;"].}

discard f(nil, nil)


# bug #7392
var x1: BaseObj
var x2 = ChildObj(x1)
n class="p">, 'img_caption', 'textarea', array('Exif.UserComment', 'Exif.TIFFImageDescription', 'Exif.TIFFUserComment')), 50 => array('Iptc.Byline', 'img_artist', 'text', array('Exif.TIFFArtist', 'Exif.Artist', 'Iptc.Credit')), 60 => array('Iptc.CopyrightNotice', 'img_copyr', 'text', array('Exif.TIFFCopyright', 'Exif.Copyright')), 70 => array('', 'img_format', 'text', array('File.Format')), 80 => array('', 'img_fsize', 'text', array('File.NiceSize')), 90 => array('', 'img_width', 'text', array('File.Width')), 100 => array('', 'img_height', 'text', array('File.Height')), 110 => array('', 'img_camera', 'text', array('Simple.Camera')), 120 => array('Iptc.Keywords', 'img_keywords', 'text', array('Exif.Category')), );