[Issue 8236] New: Wrong error message in creating struct from vector operation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 14 02:46:43 PDT 2012


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

           Summary: Wrong error message in creating struct from vector
                    operation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-06-14 02:48:54 PDT ---
struct Foo {
    int[2] v;
    Foo halve() {
        return Foo(v[] / 2);
    }
}
enum f = Foo([10, 20]).halve();
void main() {}




I think the given error message is wrong because I think there is no need for
an implicit conversion to int (dmd 2.060alpha):


test.d(4): Error: cannot implicitly convert expression (this.v[] / 2) of type
int[] to int
test.d(7):        called from here: Foo([10,20]).halve()


(Also, the code that implements the vector operations needs a CTFE guard that
disallows the ASM, unless the compiler just sets/assumes to be always false the
availability of asm at compile-time).

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