www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6358] New: ICE when using an member template (not a template instance) in an expression.

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

           Summary: ICE when using an member template (not a template
                    instance) in an expression.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kennytm gmail.com



Test case:
-------------------------------------------
struct S6358 {
    double peek(T)(int x) {
        return 0;
    }
}
void bug6358a() {
    S6358 s;
    cast(void) (s.peek is &s);   // <-- (a)
}
void bug6358b() {
    S6358 s;
    cast(void) (s.peek + &s);    // <-- (b)
}
void bug6358c() {
    S6358 s;
    s.peek += 1;    // <-- (c)
}
-------------------------------------------

The ICE in (a) happens at:

Expression *BinExp::typeCombine(Scope *sc)
{
    Type *t1 = e1->type->toBasetype();
    Type *t2 = e2->type->toBasetype();   // <-- this line, e2->type == NULL

    if (op == TOKmin || op == TOKadd)
    {

The ICE in (b) happens at:

AggregateDeclaration *isAggregate(Type *t)
{
    t = t->toBasetype();    // <-- this line, t == NULL
    if (t->ty == Tclass)
    {


The ICE in (c) happens at:

int CallExp::isLvalue()
{
//    if (type->toBasetype()->ty == Tstruct)
//      return 1;
    Type *tb = e1->type->toBasetype();   // <-- the line, e1->type == NULL

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


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
The test case doesn't compile on 2.059 Win32, but doesn't crash.

PS E:\DigitalMars\dmd2\samples> rdmd -w --main bug.d
bug.d(8): Error: cannot resolve type for s.peek(T)
bug.d(8): Error: incompatible types for ((s.peek(T)) is (& s)): '_error_' and
'S6358*'
bug.d(12): Error: cannot resolve type for s.peek(T)
bug.d(12): Error: incompatible types for ((s.peek(T)) + (& s)): '_error_' and
'S6358*'
bug.d(16): Error: cannot resolve type for s.peek(T)
PS E:\DigitalMars\dmd2\samples>

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
           Platform|Other                       |All
         Resolution|                            |WORKSFORME
         OS/Version|Mac OS X                    |All



16:46:02 PDT ---
With dmd 2.064 head:

test.d(8): Error: cannot resolve type for s.peek(T)(int x)
test.d(12): Error: cannot resolve type for s.peek(T)(int x)
test.d(16): Error: cannot resolve type for s.peek(T)(int x)

which looks correct.

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