www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8982] New: Assertion failure: '0' on line 353 in file 'ctfeexpr.c'

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

           Summary: Assertion failure: '0' on line 353 in file
                    'ctfeexpr.c'
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla digitalmars.com



13:28:20 PST ---
The following:
----------------------
import std.traits;

struct Vector
{
 float x,y,z,w;
 immutable Vector one = Vector(1,1,1,1);
}

void func(int x = 10, ref const Vector v = Vector(1,1,1,1));

pragma(msg, ParameterDefaultValueTuple!func);
-------------------------

produces:

bar.d(10): Error: Vector(1F,1F,1F,1F) is not an lvalue
Assertion failure: '0' on line 353 in file 'ctfeexpr.c'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 08 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8982




Somewhat reduced test case:

template Bug8982(func...)
{
    static if (is(typeof(func[0]) PT == __parameters))
    {
        enum Bug8982 = ((PT[0..1] args) => args[0])();
    }
}

struct V8982 {
    float x;
}

int func(ref const V8982 v = V8982(1) ){
    return 1;
}

pragma(msg, Bug8982!func);
----
The error occurs while evaluating the default argument. The resulting ErrorExp
should not be passed to CTFE, though the question is, at which stage should it
it be rejected? When instantiating the template? At is(__parameters)? Or when
creating the delegate?

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




Further reduced:
----
void bug8982(ref const int v = 7 ){}

static if (is(typeof(bug8982) P == __parameters)) {
    pragma(msg, ((P[0..1] g) => g[0])());
}

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




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

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




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d71cf042b7ff685699f0a312760dfead6af70cb4
Fix issue 8982 ICE(ctfeexpr.c) __parameters of an erroneous default parameter

Don't create a tuple with an error in it; instead, return an ErrorExp.
This is the same behaviour you get when creating a erroneous tuple by normal
means.

(The test case is wrapped in a speculative template so that the module compiles
even though
it contains an error).

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


Kenji Hara <k.hara.pg gmail.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: -------
Jan 09 2013