www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10025] New: Implicit conversion for bigint array append

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10025

           Summary: Implicit conversion for bigint array append
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-05-03 16:43:51 PDT ---
import std.bigint: BigInt;
void main() {
    auto p = new BigInt[1];
    p[0] = BigInt(1); // OK
    p[0] = 1;         // OK
    p ~= BigInt(1);   // OK
    p ~= 1;           // Error
}



DMD 2.063beta:

test.d(7): Error: cannot append type int to type BigInt[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 03 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10025


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
          Component|Phobos                      |DMD
           Severity|normal                      |enhancement


--- Comment #1 from yebblies <yebblies gmail.com> 2013-08-03 14:27:07 EST ---
     p[0] = 1;         // OK
This is assignment, so it works.
    p ~= 1;           // Error
This would be implicit construction of a BigInt from an int. That makes this an enhancement request for implicit construction on append. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 02 2013