mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 15:40:36 +03:00
Revert "Fix Issue 21456 - std.format does not accept enum member with string base type as template parameter"
This reverts commit 974a88a967
.
This commit is contained in:
parent
33b19c7cc1
commit
36221cf4cc
1 changed files with 2 additions and 21 deletions
|
@ -1356,8 +1356,8 @@ if (isSomeChar!Char)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
auto format(alias fmt, Args...)(Args args)
|
typeof(fmt) format(alias fmt, Args...)(Args args)
|
||||||
if (is(StringTypeOf!(typeof(fmt))))
|
if (isSomeString!(typeof(fmt)))
|
||||||
{
|
{
|
||||||
import std.array : appender;
|
import std.array : appender;
|
||||||
import std.range.primitives : ElementEncodingType;
|
import std.range.primitives : ElementEncodingType;
|
||||||
|
@ -1411,25 +1411,6 @@ if (is(StringTypeOf!(typeof(fmt))))
|
||||||
static assert(!__traits(compiles, format!"%f"(1.5L, 2)));
|
static assert(!__traits(compiles, format!"%f"(1.5L, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://issues.dlang.org/show_bug.cgi?id=21456
|
|
||||||
@safe pure unittest
|
|
||||||
{
|
|
||||||
enum FMTS1 = "%s is %s";
|
|
||||||
assert(format!FMTS1("Pi", 3.14) == "Pi is 3.14");
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
FMTS2 = "%s is %s"
|
|
||||||
}
|
|
||||||
assert(format!FMTS2("Pi", 3.14) == "Pi is 3.14");
|
|
||||||
|
|
||||||
enum FMTS3 : string
|
|
||||||
{
|
|
||||||
ONE = "%s is %s"
|
|
||||||
}
|
|
||||||
assert(format!(FMTS3.ONE)("Pi", 3.14) == "Pi is 3.14");
|
|
||||||
}
|
|
||||||
|
|
||||||
// called during compilation to guess the length of the
|
// called during compilation to guess the length of the
|
||||||
// result of format
|
// result of format
|
||||||
private size_t guessLength(Char, S)(S fmtString)
|
private size_t guessLength(Char, S)(S fmtString)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue