www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8481] New: assert can't concatenate strings

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

           Summary: assert can't concatenate strings
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



Copied from Forum:

----
import std.conv;
void main() {
  static assert(
    is(typeof(("Failure: " ~ to!string(55)) == string))
  );

  static assert(0 , ("Failure: " ~ to!string(55)));
}
----
main.d(7): Error: static assert  
['F','a','i','l','u','r','e',':',' ','5','5']
----

The problem is the ugly-ass "print as array of individual 
characters".

Changing the code to
----
import std.conv;
void main() {
  static assert(
    is(typeof(("Failure: " ~ to!string(55)) == string))
  );

  static assert(0 , text("Failure: ", to!string(55)));
    or
  static assert(0 , format("Failure: %s", to!string(55)));
}
----
Works as intended.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8481


Ellery Newcomer <ellery-newcomer utulsa.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ellery-newcomer utulsa.edu
         Resolution|                            |DUPLICATE



17:43:30 PDT ---
*** This issue has been marked as a duplicate of issue 7998 ***

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