Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 21916 - Error message is obfuscated when using wrong format… #8070

Merged
merged 1 commit into from
May 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions std/format/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ if (isInputRange!Range)
}

// Used to check format strings are compatible with argument types
package(std) static const checkFormatException(alias fmt, Args...) =
package(std) enum checkFormatException(alias fmt, Args...) =
{
import std.conv : text;

Expand All @@ -743,7 +743,7 @@ package(std) static const checkFormatException(alias fmt, Args...) =
enforceFmt(n == Args.length, text("Orphan format arguments: args[", n, "..", Args.length, "]"));
}
catch (Exception e)
return e;
return e.msg;
return null;
}();

Expand Down Expand Up @@ -1367,7 +1367,7 @@ if (isSomeString!(typeof(fmt)))
alias e = checkFormatException!(fmt, Args);
alias Char = Unqual!(ElementEncodingType!(typeof(fmt)));

static assert(!e, e.msg);
static assert(!e, e);
auto w = appender!(immutable(Char)[]);

// no need to traverse the string twice during compile time
Expand Down