[Issue 12331] New: Wrong error message for undefined identifier at compile-time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 9 07:29:29 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12331
Summary: Wrong error message for undefined identifier at
compile-time
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2014-03-09 07:29:28 PDT ---
This is wrong code:
int[] foo() {
int[] result;
result.reserve = 5;
foreach (item; result)
result ~= r;
return result;
}
enum r = foo();
void main() {}
dmd 2.066alpha gives an error message that I don't understand:
test.d(1,7): Error: function test2.foo circular dependency. Functions cannot be
interpreted while being compiled
test.d(8,13): called from here: foo()
test.d(8,13): called from here: foo()
If I remove the compile-time call it gives the right error message:
int[] foo() {
int[] result;
result.reserve = 5;
foreach (item; result)
result ~= r;
return result;
}
//enum r = foo();
void main() {}
test.d(5,19): Error: undefined identifier r
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list