diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 4c1a1b4cb3..8bff73768d 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -296,6 +296,11 @@ proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode; start=0; expectedType: PT replaceTypeVarsS(cl, n.sym, replaceTypeVarsT(cl, n.sym.typ)) if result.sym.kind == skField and (cl.owner == nil or result.sym.owner == cl.owner): + if not cl.allowMetaTypes and result.typ != nil and result.typ.isMetaType: + localError(cl.c.config, result.info, + "'" & result.typ.typeToString & "' is not a concrete type") + result.typ = errorType(cl.c) + result.sym.typ = result.typ if result.sym.ast != nil: # instantiate default value of object/tuple field var n = result.sym.ast diff --git a/tests/generics/t24848.nim b/tests/generics/t24848.nim new file mode 100644 index 0000000000..b57e68884b --- /dev/null +++ b/tests/generics/t24848.nim @@ -0,0 +1,9 @@ +discard """ + errormsg: "'array[0..0, typedesc[R[system.int]]]' is not a concrete type" + line: 7 +""" + +type R[C] = ref object + b: C + +discard R[[R[int]]]()