www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10599] New: CTFE: assert failure interpret.c 310

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

           Summary: CTFE: assert failure interpret.c 310
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla digitalmars.com


--- Comment #0 from Walter Bright <bugzilla digitalmars.com> 2013-07-10
12:00:26 PDT ---
The following:

----------------------------
struct Bug {
    int val = 3.45;
}
int bug()
{
    Bug p = Bug();
    return 1;
}

static assert(bug());
-----------------------------

causes:

ice.d(4): Error: cannot implicitly convert expression (3.45) of type double to
int
CTFE: ErrorExp in ice.d(6)
assert interpret.c(310) 0

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10599



--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2013-07-10
12:03:58 PDT ---
This is currently blocking:

https://github.com/D-Programming-Language/dmd/pull/2146

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10599



--- Comment #2 from Don <clugdbug yahoo.com.au> 2013-07-10 23:41:27 PDT ---
This is an error propagation bug that the CTFE AST validator is detecting.

The "implicit conversion" error message occurs when running semantic on Bug(). 

Later on, when compiling bug(), no new error message is generated, even though
it uses the ErrorExp from the default initializer of Bug(). So, bug() isn't
marked as containing an error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10599



--- Comment #3 from github-bugzilla puremagic.com 2013-07-12 11:44:35 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/8a9421b4d1e8b577a412a40bce0979a17a63a9c8
Fix bug 10599 CTFE assert with bad struct initializer

This is an ErrorExp propagation/gagging bug. Errors in struct initializers
don't generate error messages when used, but still need to report an
error to the enclosing function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 12 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10599


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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