digitalmars.D.bugs - [Issue 6696] New: Error messages for const/immutable arrays given to immutable/const
- d-bugmail puremagic.com (42/42) Sep 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6696
- d-bugmail puremagic.com (15/15) Oct 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6696
http://d.puremagic.com/issues/show_bug.cgi?id=6696 Summary: Error messages for const/immutable arrays given to immutable/const Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: minor Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2011-09-19 14:52:47 PDT --- A wrong D2 program: void foo(immutable ref int[5] a) {} void bar(const ref int[5] a) {} void main() { const int[5] arr1; foo(arr1); // line 5 immutable int[5] arr2; bar(arr2); // line 7 } DMD 2.055 prints: test.d(5): Error: function test.foo (ref immutable immutable(int[5u]) a) is not callable using argument types (const(int[5u])) test.d(5): Error: cast(immutable(int[5u]))arr1 is not an lvalue test.d(7): Error: cast(const(int[5u]))arr2 is not an lvalue The first error message is almost good, but why does it print "immutable immutable"? I think the second error message is useless. In line 7 the bar(arr2) call gives just a "arr2 is not an lvalue" that I think is not good enough. So for this program I think a better error message printout is something like: test.d(5): Error: function test.foo(ref immutable(int[5]) a) is not callable using argument types (const(int[5])). test.d(7): Error: function test.foo(ref const(int[5]) a) is not callable using argument types (immutable(int[5])). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6696 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |FIXED --- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-10-20 18:18:39 PDT --- Only error now is: Error: function test.foo (ref immutable(int[5u]) a) is not callable using argument types (const(int[5u])) line 7 is now allowed apparently. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 20 2012