[Issue 17267] New: Forward reference error in recursive template
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Mar 19 02:56:25 PDT 2017
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: nobody at puremagic.com
Reporter: japplegame at gmail.com
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;
}
--
More information about the Digitalmars-d-bugs
mailing list