https://issues.dlang.org/show_bug.cgi?id=17267
Issue ID: 17267
Summary: Forward reference error in recursive template
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
This code compiles:
struct A(T) {
T* ptr;
void m() {
pragma(msg, T.sizeof);
}
}
struct B {
int i;
A!B a;
}
Following should compile, but doesn't (struct foo.B no size because of forward
reference):
// example 1 (struct definition inside function)
struct A(T) {
T* ptr;
void m() {
pragma(msg, T.sizeof);
}
}
void foo() {
static struct B {
int i;
A!B a;
}
}
// example 2 (sizeof outside member function)
struct A(T) {
T* ptr;
pragma(msg, T.sizeof);
}
struct B {
int i;
A!B a;
}
--