https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108055
Bug ID: 108055
Summary: d: Undefined reference to nested lambda in template
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
issue.d:
---
import std.conv;
void main()
{
float* zis ;
static if (is(typeof(to!string(*zis))))
to!string(*zis);
}
---
std/conv.d:
---
T toStr(T, S)(S src)
{
static if (is(typeof(T.init[0]) E))
{
struct Appender
{
inout(E)[] data;
}
import std.format.spec;
import std.format.write;
auto w = Appender();
FormatSpec!E f;
formatValue(w, src, f);
return w.data;
}
}
T to(T, A)(A args)
{
return toStr!T(args);
}
---
std/format/spec.d:
---
module std.format.spec;
template Unqual(T : const U, U)
{
alias Unqual = U;
}
template FormatSpec(Char)
if (!is(Unqual!Char == Char))
{
alias FormatSpec = FormatSpec!(Unqual!Char);
}
struct FormatSpec(Char)
if (is(Unqual!Char == Char))
{
const(Char)[] nested;
}
---
std/format/write.d:
---
module std.format.write;
import std.format.spec;
void formatValueImpl(Writer, T, Char)(ref Writer , const(T) ,
scope const ref FormatSpec!Char )
{
T val;
char spec;
(ref val) @trusted {
return (cast(const char*) &val)[0 .. val.sizeof];
}(val);
}
void formatValue(Writer, T, Char)(Writer w, T val, Char f)
{
formatValueImpl(w, val, f);
}
---