View mode: basic / threaded / horizontal-split · Log in · Help
October 07, 2011
[Issue 6783] New: Implicit cast to immutable from pure function
http://d.puremagic.com/issues/show_bug.cgi?id=6783

          Summary: Implicit cast to immutable from pure function
          Product: D
          Version: D2
         Platform: x86
       OS/Version: Windows
           Status: NEW
         Keywords: rejects-valid
         Severity: normal
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2011-10-07 15:34:46 PDT ---
This program compiles with no errors (DMD 2.056head):


immutable(int[]) foo(in int[2] x) pure {
   return new int[1];
}
void main() {}



While this doesn't compile:


immutable(int[]) foo(in int[] x) pure {
   return new int[1];
}
void main() {}


It gives:
test.d(2): Error: cannot implicitly convert expression (new int[](1u)) of type
int[] to immutable(int[])

I am not sure, but I think the second program too is correct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 17, 2011
[Issue 6783] Implicit cast to immutable from pure function
http://d.puremagic.com/issues/show_bug.cgi?id=6783



--- Comment #1 from bearophile_hugs@eml.cc 2011-10-16 17:45:03 PDT ---
See also:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=30104

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2011
[Issue 6783] Implicit cast to immutable from pure function
http://d.puremagic.com/issues/show_bug.cgi?id=6783



--- Comment #2 from bearophile_hugs@eml.cc 2011-10-18 15:02:34 PDT ---
This enhancement request has some problems. See also:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=30139

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 19, 2011
[Issue 6783] Implicit cast to immutable from pure function
http://d.puremagic.com/issues/show_bug.cgi?id=6783



--- Comment #3 from bearophile_hugs@eml.cc 2011-10-19 15:46:43 PDT ---
See also:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=30167

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 16, 2013
[Issue 6783] Implicit cast to immutable from pure function
http://d.puremagic.com/issues/show_bug.cgi?id=6783


yebblies <yebblies@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
                CC|                            |yebblies@gmail.com
          Platform|x86                         |All
        Resolution|                            |DUPLICATE
        OS/Version|Windows                     |All
          Severity|normal                      |enhancement


--- Comment #4 from yebblies <yebblies@gmail.com> 2013-01-17 01:07:31 EST ---
*** This issue has been marked as a duplicate of issue 8408 ***

-- 
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