digitalmars.D.bugs - [Issue 4757] New: A forward reference error with return of inner defined struct
- d-bugmail puremagic.com (50/50) Aug 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4757
http://d.puremagic.com/issues/show_bug.cgi?id=4757 Summary: A forward reference error with return of inner defined struct Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is a problem with a return of inner defined struct, I don't know if this specific case is already present in Bugzilla. I think others are already present. DMD 2.048 compiles and runs this code with no errors: static struct Bar(T) { void spam() { foo(1); } } Bar!T foo(T)(T) { return Bar!T(); } void main() { foo(1); } But if I pull the Bar struct inside foo(), using auto as return type: auto foo(T)(T) { static struct Bar(T) { void spam() { foo(1); } } return Bar!T(); } void main() { foo(1); } I receive at compile-time: test.d(4): Error: forward reference to inferred return type of function call foo(1) test.d(7): Error: template instance test.foo!(int).foo.Bar!(int) error instantiating test.d(10): instantiated from here: foo!(int) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 29 2010