diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 3896a46caf6c6..1e26081089f02 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -376,8 +376,7 @@ proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: var TLoc, else: linefmt(p, section, "$1.m_type = $2;$n", [r, genTypeInfoV1(p.module, t, a.lode.info)]) of frEmbedded: - # inheritance in C++ does not allow struct initialization: bug #18410 - if not p.module.compileToCpp and optTinyRtti in p.config.globalOptions: + if optTinyRtti in p.config.globalOptions: var tmp: TLoc if mode == constructRefObj: let objType = t.skipTypes(abstractInst+{tyRef}) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 6d306d0e6eeaf..be79bb398ec38 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -89,7 +89,7 @@ compiler gcc: asmStmtFrmt: "__asm__($1);$n", structStmtFmt: "$1 $3 $2 ", # struct|union [packed] $name produceAsm: gnuAsmListing, - cppXsupport: "-std=gnu++14 -funsigned-char", + cppXsupport: "-std=gnu++17 -funsigned-char", props: {hasSwitchRange, hasComputedGoto, hasCpp, hasGcGuard, hasGnuAsm, hasAttribute}) @@ -116,7 +116,7 @@ compiler nintendoSwitchGCC: asmStmtFrmt: "asm($1);$n", structStmtFmt: "$1 $3 $2 ", # struct|union [packed] $name produceAsm: gnuAsmListing, - cppXsupport: "-std=gnu++14 -funsigned-char", + cppXsupport: "-std=gnu++17 -funsigned-char", props: {hasSwitchRange, hasComputedGoto, hasCpp, hasGcGuard, hasGnuAsm, hasAttribute}) diff --git a/tests/cpp/torc.nim b/tests/cpp/torc.nim index 7fc474f94d4de..636105f31afa4 100644 --- a/tests/cpp/torc.nim +++ b/tests/cpp/torc.nim @@ -12,4 +12,14 @@ type proc p(): Option[O] = none(O) -doAssert $p() == "none(O)" \ No newline at end of file +doAssert $p() == "none(O)" + +# bug #17351 +type + Foo = object of RootObj + Foo2 = object of Foo + Bar = object + x: Foo2 + +var b = Bar() +discard b