@@ -18,7 +18,9 @@ import dmd.dscope;
1818import dmd.dclass;
1919import dmd.dstruct;
2020import dmd.errors;
21+ import dmd.errorsink;
2122import dmd.expression;
23+ import dmd.hdrgen : toErrMsg;
2224import dmd.location;
2325import dmd.mtype;
2426import dmd.templatesem;
@@ -40,6 +42,8 @@ import core.stdc.stdio;
4042bool genTypeInfo (Expression e, Loc loc, Type torig, Scope* sc)
4143{
4244 // printf("genTypeInfo() %s\n", torig.toChars());
45+ import dmd.globals : global;
46+ auto eSink = global.errorSink;
4347
4448 // Even when compiling without `useTypeInfo` (e.g. -betterC) we should
4549 // still be able to evaluate `TypeInfo` at compile-time, just not at runtime.
@@ -51,9 +55,9 @@ bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
5155 {
5256 global.gag = 0 ;
5357 if (e)
54- .error(loc, " expression `%s` uses the GC and cannot be used with switch `-betterC`" , e.toErrMsg());
58+ eSink .error(loc, " expression `%s` uses the GC and cannot be used with switch `-betterC`" , e.toErrMsg());
5559 else
56- .error(loc, " `TypeInfo` cannot be used with `-betterC`" );
60+ eSink .error(loc, " `TypeInfo` cannot be used with `-betterC`" );
5761
5862 if (sc && sc.tinst)
5963 sc.tinst.printInstantiationTrace(Classification.error, uint .max);
@@ -64,7 +68,7 @@ bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
6468
6569 if (! Type.dtypeinfo)
6670 {
67- .error(loc, " `object.TypeInfo` could not be found, but is implicitly used" );
71+ eSink .error(loc, " `object.TypeInfo` could not be found, but is implicitly used" );
6872 fatal();
6973 }
7074
0 commit comments