[Issue 9916] New: int*[] implicitly converts to int*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 10 03:22:24 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9916

           Summary: int*[] implicitly converts to int*
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: phyphor0 at gmail.com


--- Comment #0 from phyphor0 at gmail.com 2013-04-10 03:22:23 PDT ---
Found on 2.062 on Windows, haven't tested other platforms, but it would
presumably be the same. Working version is 2.057. I'm not sure if this is a
compiler issue or something in the library instead

int x = 1, y = 2, z = 3;
int *[] a = [&x,&y,&z];
int *b = a;
int **c = a.ptr;

The previous bundle I have reports a no implicit conversion error on the b = a
assignment.

The result of this is (b == c) in raw pointer values and (*b == *c == &x), and
isImplicitlyConvertible!(int*[], int*) is evaluating to true.

Additional info:
- int*[] can convert to int*, but int[] can't convert to int, so it requires a
pointer somewhere
- if I change a from int*[] to int*[3], I get the error I would expect (no
implicit conversion)
- it does work for more than one level of pointers, but the type must match (ie
int***[] -> int***)

This is causing weirdness in the container templates because pointer usage
evaluates to multiple possible templates with isImplicitlyConvertible being
broken and is probably the cause of issue 9518

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


More information about the Digitalmars-d-bugs mailing list