From bc42e9aa9877e341668f5278bddda73f403d01e4 Mon Sep 17 00:00:00 2001 From: cooldome Date: Mon, 18 May 2020 08:38:36 +0100 Subject: [PATCH] fix #14369 (#14386) * fix #14369 * empty commit --- compiler/ccgstmts.nim | 1 + tests/exception/tcpp_imported_exc2.nim | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/exception/tcpp_imported_exc2.nim diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 20780f7343..ca6e51f29a 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -727,6 +727,7 @@ proc genRaiseStmt(p: BProc, t: PNode) = initLocExprSingleUse(p, t[0], a) finallyActions(p) var e = rdLoc(a) + discard getTypeDesc(p.module, t[0].typ) var typ = skipTypes(t[0].typ, abstractPtrs) # XXX For reasons that currently escape me, this is only required by the new # C++ based exception handling: diff --git a/tests/exception/tcpp_imported_exc2.nim b/tests/exception/tcpp_imported_exc2.nim new file mode 100644 index 0000000000..ff299ea3df --- /dev/null +++ b/tests/exception/tcpp_imported_exc2.nim @@ -0,0 +1,10 @@ +discard """ +targets: "cpp" +output: "" +""" +#issue #14369 case 2 +type RuntimeError {.requiresInit, importcpp: "std::runtime_error", header: "".} = object + +proc initRuntimeError(a: cstring): RuntimeError {.importcpp: "std::runtime_error(@)", constructor.} +try: raise initRuntimeError("foo2") +except: discard