www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8236] New: Wrong error message in creating struct from vector operation


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

--- Comment #0 from bearophile_hugs 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: -------
Jun 14 2012