D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2737 - Nonsensical Error Message on Unsafe .idup
Summary: Nonsensical Error Message on Unsafe .idup
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: diagnostic, patch
: 6252 (view as issue list)
Depends on:
Blocks:
 
Reported: 2009-03-16 12:31 UTC by David Simcha
Modified: 2014-02-14 20:35 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-03-16 12:31:09 UTC
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.
Comment 1 yebblies 2011-07-08 19:10:36 UTC
*** Issue 6252 has been marked as a duplicate of this issue. ***
Comment 2 yebblies 2011-07-08 19:14:49 UTC
The error message is actually in there, it's just hidden by the hacky ufcs is implemented.