D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21916 - Error message is obfuscated when using wrong format specifier at compile-time
Summary: Error message is obfuscated when using wrong format specifier at compile-time
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P4 minor
Assignee: No Owner
URL:
Keywords: diagnostic, pull
Depends on:
Blocks:
 
Reported: 2021-05-12 22:56 UTC by Vladimir Panteleev
Modified: 2021-05-13 00:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2021-05-12 22:56:16 UTC
/////// test.d //////
import std.format;

void main()
{
    format!"%f"([1]);
}
/////////////////////

Currently produces:

.../std/format/package.d(748): Error: expression `FormatException(['I', 'n', 'c', 'o', 'r', 'r', 'e', 'c', 't', ' ', 'f', 'o', 'r', 'm', 'a', 't', ' ', 's', 'p', 'e', 'c', 'i', 'f', 'i', 'e', 'r', ' ', 'f', 'o', 'r', ' ', 'r', 'a', 'n', 'g', 'e', ':', ' ', '%', 'f'], ".../std/format/internal/write.d", 1722LU, null, null, 0u)` is not constant
.../std/format/package.d(1370):        while evaluating: `static assert(!e)`
test.d(5): Error: template instance `std.format.format!("%f", int[])` error instantiating
Comment 1 Dlang Bot 2021-05-12 22:59:02 UTC
@CyberShadow created dlang/phobos pull request #8070 "Fix Issue 21916 - Error message is obfuscated when using wrong format…" fixing this issue:

- Fix Issue 21916 - Error message is obfuscated when using wrong format specifier at compile-time

https://github.com/dlang/phobos/pull/8070
Comment 2 Dlang Bot 2021-05-13 00:22:33 UTC
dlang/phobos pull request #8070 "Fix Issue 21916 - Error message is obfuscated when using wrong format…" was merged into master:

- c2337fcad8ccb291d59bb42d3aeda3929f4e7063 by Vladimir Panteleev:
  Fix Issue 21916 - Error message is obfuscated when using wrong format specifier at compile-time

https://github.com/dlang/phobos/pull/8070