Bug 3539 – Template instantiation fails in an obscured way. See details.
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-11-21T14:44:00Z
Last change time
2015-06-09T01:27:03Z
Assigned to
nobody
Creator
e.insafutdinov
Comments
Comment #0 by e.insafutdinov — 2009-11-21T14:44:06Z
Test case:
void boo(T)(T* ptr, const ref T t)
{
static if (__traits(compiles, ptr.__postblit()))
{}
}
void main()
{
double b;
const double a = b;
double* ptr;
boo!double(ptr, a);
}
Commenting out static if (...) line makes it work. Or otherwise if you call boo with non-const argument(b) it works too.
This one is a blocker for QtD. Basically I need the way, to allocate a copy of a value on the C heap. In order to do that I allocate the memory chunk with malloc, then call memcpy() and then, if the value type has postblit I call it. This bugs prevents me to implement this.
Comment #1 by e.insafutdinov — 2009-11-21T14:48:34Z
Oh sorry my wrong, it is not that a big blocker, but I believe it is worth investigating anyway, since the issue was hard to narrow down and cost me couple of hours of identifying.
Thanks.