[Issue 2737] New: Nonsensical Error Message on Unsafe .idup
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 16 10:31:06 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2737
Summary: Nonsensical Error Message on Unsafe .idup
Product: D
Version: unspecified
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: dsimcha at yahoo.com
void main() {
uint[][] foo = [[1, 2], [3, 4], [5, 6]];
immutable bar = foo.idup;
}
Compiler error:
test.d(3): Error: undefined identifier module test.idup
test.d(3): Error: function expected before (), not module test.idup of type
void
Of course, the compiler should not allow .idup to be applied to foo because,
unless a deep copy were made, this would cause unsafe aliasing between mutable
and immutable. However, a better error message might be a good thing.
--
More information about the Digitalmars-d-bugs
mailing list