Thread overview
[Issue 1969] New: Internal error: ..\ztc\cod1.c 1662
Apr 02, 2008
d-bugmail
[Issue 1969] ICE(cod1.c) using undefined operator with one const operand
May 19, 2009
Don
Jul 13, 2009
Don
Sep 03, 2009
Walter Bright
April 02, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1969

           Summary: Internal error: ..\ztc\cod1.c 1662
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: sardonicpresence@gmail.com


The following code results in an Internal error in DMD 2.012:

////////

struct Foo { }

struct Bar
{
  public Foo opSub(Bar other)
  {
    return Foo();
  }
}

void main()
{
  // Removing the following const eliminates the error
  const Foo test = Foo();

  // Causes the error as (Foo + Foo) is undefined
  auto result = test + (Bar() - Bar());

  auto ok1 = test + test;  // No error
  auto ok2 = test + Foo(); // No error
}

////////


-- 

May 19, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1969


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
            Summary|Internal error:             |ICE(cod1.c) using undefined
                   |..\ztc\cod1.c 1662          |operator with one const
                   |                            |operand




--- Comment #1 from Don <clugdbug@yahoo.com.au>  2009-05-19 01:01:53 PDT ---
Simplified test case

struct Bar{ }

const(Bar) baz() { return Bar(); }

void foo() {
  Bar result = Bar() + baz();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1969


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
           Severity|minor                       |normal




--- Comment #2 from Don <clugdbug@yahoo.com.au>  2009-07-13 04:53:56 PDT ---
/* Root cause: BinExp::typeCombine() is checking for an _exact_ match, but
typeMerge() will return success.

PATCH: cast.c BinExp::typeCombine().
Compare the immutable versions of the types, instead of the types themselves.

    if (op == TOKmin || op == TOKadd)
    {
    if (t1->ito == t2->ito && (t1->ty == Tstruct || t1->ty == Tclass))
     goto Lerror;
     }
*/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1969


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED




--- Comment #3 from Walter Bright <bugzilla@digitalmars.com>  2009-09-03 13:33:04 PDT ---
Fixed dmd 2.032

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