www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 222] New: "Internal error: ..\ztc\cod1.c 1656" with && and ||

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

           Summary: "Internal error: ..\ztc\cod1.c 1656" with && and ||
           Product: D
           Version: 0.161
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


Try:

void f()
{

}

..

int x = 0 || f();
int y = 1 && f();

Either declaration gives the error in the message.

According to the spec, the result of && and || is void if the second operand is
void.  So this isn't valid code.


-- 
Jun 23 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-06-23:
 http://d.puremagic.com/issues/show_bug.cgi?id=222

 Try:

 void f()
 {

 }

 ..

 int x = 0 || f();
 int y = 1 && f();

 Either declaration gives the error in the message.

 According to the spec, the result of && and || is void if the second operand is
 void.  So this isn't valid code.

Added to DStress as http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_A.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_B.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_C.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_D.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_E.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_F.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_G.d http://dstress.kuehne.cn/nocompile/b/bug_cod1_1656_H.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEo7X/3w+/yD4P9tIRAjcwAKCXkStJ9Cw9GGXv6C2cJgkiUC8URACgo0Bp XXJU8Y3DpHxKLTs5sczN3Cw= =crKx -----END PGP SIGNATURE-----
Jun 29 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=222


deewiant gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deewiant gmail.com
           Keywords|ice-on-invalid-code         |diagnostic
           Priority|P2                          |P3




------- Comment #1 from deewiant gmail.com  2006-07-01 05:26 -------
In DMD 0.162, both give the error "non-constant expression cast(int)(!!(f)())".

The error message is misleading, so this is still a bug, but of a different
sort. I'd change the version of the bug to 0.162 if it were possible...


-- 
Jul 01 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=222


deewiant gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|0.161                       |0.163




------- Comment #2 from deewiant gmail.com  2006-07-22 08:27 -------
Changed the version to 0.163, as the behaviour remains the same there.


-- 
Jul 22 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=222





------- Comment #3 from braddr puremagic.com  2006-10-16 03:23 -------
Here's a cut/pasteable reprocase.  It doesn't produced the error mentioned in
comment 2, but it does produce the internal error in the summary.

void f() { }

void main() {
    int x = 0 || f();
    int y = 1 && f();
}

$ dmd -v 222.d  (this is dmd 169)
parse     222
semantic  222
semantic2 222
semantic3 222
code      222
generating code for function 'f'
generating code for function 'main'
Internal error: ../ztc/cod1.c 1660


-- 
Oct 16 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=222


bugzilla digitalmars.com changed:

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




------- Comment #4 from bugzilla digitalmars.com  2006-11-25 03:25 -------
Fixed DMD 0.175


-- 
Nov 25 2006