View mode: basic / threaded / horizontal-split · Log in · Help
December 29, 2012
[Issue 9240] New: (Regression: 2.058) non-const does not implicitly convert to const
http://d.puremagic.com/issues/show_bug.cgi?id=9240

          Summary: (Regression: 2.058) non-const does not implicitly
                   convert to const
          Product: D
          Version: D2
         Platform: All
       OS/Version: All
           Status: NEW
         Severity: regression
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-29 08:48:00 PST ---
void ok(const(int*)*) { }
void ng(const(int)**) { }

void main()
{
   int** x;
   ok(x);
   ng(x);
}

'ng' call fails to compile since 2.058

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 13, 2013
[Issue 9240] (Regression: 2.058) non-const does not implicitly convert to const
http://d.puremagic.com/issues/show_bug.cgi?id=9240



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-12 19:32:48 PST ---
Introduced by:

commit d3cd1bf6db3689fb16c8f97572ae8bbf92ec9df7
Author: k-hara <k.hara.pg@gmail.com>
Date:   Tue Dec 13 15:03:44 2011 +0900

   Issue 4251 - Hole in the const system: immutable(T)[] implicitly casts to
ref const(T)[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 14, 2013
[Issue 9240] (Regression: 2.058) non-const does not implicitly convert to const
http://d.puremagic.com/issues/show_bug.cgi?id=9240


yebblies <yebblies@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
                CC|                            |yebblies@gmail.com
        Resolution|                            |INVALID


--- Comment #2 from yebblies <yebblies@gmail.com> 2013-01-14 22:33:33 EST ---
This is not a bug.  See the examples in issue 4251 for how allowing this would
break const.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 14, 2013
[Issue 9240] (Regression: 2.058) non-const does not implicitly convert to const
http://d.puremagic.com/issues/show_bug.cgi?id=9240



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-14 07:43:19 PST ---
(In reply to comment #2)
> This is not a bug.  See the examples in issue 4251 for how allowing this would
> break const.

Exact comment which explains this:
http://d.puremagic.com/issues/show_bug.cgi?id=4251#c9

I think this could go to the spec as a small note. It was brought up on IRC by
someone converting some C++ code to D, and at first sight it seemed like a
rejects-valid. A few of us agreed and I filed it, but comment #9 above explains
the problem perfectly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home