* fix #18410 * one line comment * typo * typo * cover cpp
This commit is contained in:
parent
2bda4a30a6
commit
2f730afe9e
3 changed files with 19 additions and 2 deletions
|
|
@ -363,7 +363,8 @@ proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: var TLoc,
|
||||||
else:
|
else:
|
||||||
linefmt(p, section, "$1.m_type = $2;$n", [r, genTypeInfoV1(p.module, t, a.lode.info)])
|
linefmt(p, section, "$1.m_type = $2;$n", [r, genTypeInfoV1(p.module, t, a.lode.info)])
|
||||||
of frEmbedded:
|
of frEmbedded:
|
||||||
if optTinyRtti in p.config.globalOptions:
|
# inheritance in C++ does not allow struct initialization: bug #18410
|
||||||
|
if not p.module.compileToCpp and optTinyRtti in p.config.globalOptions:
|
||||||
var tmp: TLoc
|
var tmp: TLoc
|
||||||
if mode == constructRefObj:
|
if mode == constructRefObj:
|
||||||
let objType = t.skipTypes(abstractInst+{tyRef})
|
let objType = t.skipTypes(abstractInst+{tyRef})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''@[(s1: "333", s2: ""), (s1: "abc", s2: "def"), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "lastone", s2: "")]'''
|
output: '''@[(s1: "333", s2: ""), (s1: "abc", s2: "def"), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "lastone", s2: "")]'''
|
||||||
cmd: "nim c --gc:arc $file"
|
matrix: "--gc:arc"
|
||||||
|
targets: "c cpp"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# bug #13240
|
# bug #13240
|
||||||
|
|
|
||||||
15
tests/cpp/torc.nim
Normal file
15
tests/cpp/torc.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
discard """
|
||||||
|
targets: "cpp"
|
||||||
|
matrix: "--gc:orc"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import std/options
|
||||||
|
|
||||||
|
# bug #18410
|
||||||
|
type
|
||||||
|
O = object of RootObj
|
||||||
|
val: pointer
|
||||||
|
|
||||||
|
proc p(): Option[O] = none(O)
|
||||||
|
|
||||||
|
doAssert $p() == "none(O)"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue