diff --git a/compiler/src/dmd/pragmasem.d b/compiler/src/dmd/pragmasem.d index 664ca38a295f..503fb1b64a03 100644 --- a/compiler/src/dmd/pragmasem.d +++ b/compiler/src/dmd/pragmasem.d @@ -442,8 +442,8 @@ private bool pragmaMsgSemantic(Loc loc, Scope* sc, Expressions* args) if (expressionsToString(buf, sc, args, loc, "while evaluating `pragma(msg, %s)`", false)) return false; - buf.writestring("\n"); - fprintf(stderr, "%s", buf.extractChars); + auto eSink = global.errorSink; + eSink.message(Loc.init, "%s", buf.extractChars); return true; } diff --git a/compiler/test/dshell/issue20444_SOURCE_DATE_EPOCH.d b/compiler/test/dshell/issue20444_SOURCE_DATE_EPOCH.d index 1a4da3e855bd..386500e64112 100644 --- a/compiler/test/dshell/issue20444_SOURCE_DATE_EPOCH.d +++ b/compiler/test/dshell/issue20444_SOURCE_DATE_EPOCH.d @@ -16,5 +16,11 @@ void main () const output = shellExpand("$OUTPUT_BASE/source_date_epoch.txt"); run("$DMD -m$MODEL -o- -c $EXTRA_FILES/source_date_epoch.d", stdout, File(output, "wb"), env); const result = readText(output).filterCompilerOutput; + if (result != expected) + { + import core.stdc.stdio : fprintf, stderr; + fprintf(stderr, "result : [%.*s]\n", cast(int)result.length, result.ptr); + fprintf(stderr, "expected: [%.*s]\n", cast(int)expected.length, expected.ptr); + } assert(result == expected, result); }