Thread overview
[Bug 99] New: superfluous output for failed static asserts
Apr 11, 2006
d-bugmail
Jun 01, 2006
d-bugmail
Jun 02, 2006
d-bugmail
April 11, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=99

           Summary: superfluous output for failed static asserts
           Product: D
           Version: 0.153
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: trivial
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


== source.d ==
int i;
static assert(i);

>dmd -c source.d
source.d(2): static assert  (i) is not evaluatable at compile time
i

Note the superfluous i in the second line.

Cause:
diff -urBb /opt/dmd/0.151/src/dmd/staticassert.c
/opt/dmd/0.153/src/dmd/staticassert.c
--- /opt/dmd/0.151/src/dmd/staticassert.c
+++ /opt/dmd/0.153/src/dmd/staticassert.c
@@ -51,7 +51,10 @@
     if (e->isBool(FALSE))
        error("(%s) is false", exp->toChars());
     else if (!e->isBool(TRUE))
+    {
        error("(%s) is not evaluatable at compile time", exp->toChars());
+printf("%s\n", e->toChars());
+    }
 }

 int StaticAssert::oneMember(Dsymbol **ps)


-- 

June 01, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=99





------- Comment #1 from clugdbug@yahoo.com.au  2006-06-01 05:24 -------
This seems to be fixed. It works OK in DMD 0.158 Windows, and the bad line in staticassert.c is gone. Please confirm.

(In reply to comment #0)
> == source.d ==
> int i;
> static assert(i);
> 
> >dmd -c source.d
> source.d(2): static assert  (i) is not evaluatable at compile time
> i
> 
> Note the superfluous i in the second line.
> 
> Cause:
> diff -urBb /opt/dmd/0.151/src/dmd/staticassert.c
> /opt/dmd/0.153/src/dmd/staticassert.c
> --- /opt/dmd/0.151/src/dmd/staticassert.c
> +++ /opt/dmd/0.153/src/dmd/staticassert.c
> @@ -51,7 +51,10 @@
>      if (e->isBool(FALSE))
>         error("(%s) is false", exp->toChars());
>      else if (!e->isBool(TRUE))
> +    {
>         error("(%s) is not evaluatable at compile time", exp->toChars());
> +printf("%s\n", e->toChars());
> +    }
>  }
> 
>  int StaticAssert::oneMember(Dsymbol **ps)
> 


-- 

June 02, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=99


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2006-06-01 21:47 -------
Superfluous printf removed.


--