Thread overview
[Issue 8270] New: Different error messages for missing const in var[] and var.opSlice()
Jun 20, 2012
Matthias Walter
Dec 27, 2012
Andrej Mitrovic
Dec 27, 2012
Andrej Mitrovic
June 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8270

           Summary: Different error messages for missing const in var[]
                    and var.opSlice()
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: xammy@xammy.homelinux.net


--- Comment #0 from Matthias Walter <xammy@xammy.homelinux.net> 2012-06-20 01:19:59 PDT ---
Consider the following code:

struct S
{
  void opSlice() { }
}

void main()
{
  const(S) s;
  s[];
  s.opSlice();
}

It results in two error messages from which the second is correct since it comlains about opSlice not being const but s being a const(S). The first one misses this information.

Error: function main.S.opSlice () is not callable using argument types ()
Error: function main.S.opSlice () is not callable using argument types () const

This bug does not seem to affect other operators like opIndex or opCall.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8270


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-12-26 16:11:04 PST ---
Fixed in 2.061, both messages are like #2 now.

However it will also get better after pull 1407 is merged (http://d.puremagic.com/issues/show_bug.cgi?id=8270):

test.d(12): Error: mutable method test.S.opSlice is not callable using const
object
test.d(13): Error: mutable method test.S.opSlice is not callable using const
object

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8270



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-26 16:11:30 PST ---
(In reply to comment #1)
> Fixed in 2.061, both messages are like #2 now.
> 
> However it will also get better after pull 1407 is merged (http://d.puremagic.com/issues/show_bug.cgi?id=8270):

Wrong like, should be: https://github.com/D-Programming-Language/dmd/pull/1407

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------