www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1276] New: static assert message displayed with escaped characters

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

           Summary: static assert message displayed with escaped characters
           Product: D
           Version: 1.015
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: smjg iname.com


If I try to make a static assert message span multiple lines, it doesn't work. 
This is because it tries to display it as a string in code, and in the process
turns certain characters into their escape sequences.  

----------
static assert (false,
"An error message
\tthat spans multiple lines, and also contains such characters as a tab,
\\ and \".");
----------
static_assert_linebreaks.d(1): static assert  "An error message\x0a\x09that
spans multiple lines, and also contains such characters as a tab,\x0a\\' and
\"."
----------

Since the purpose of this is to display a message while running the compiler,
it should just display the string, rather than a code representation of it. 
That is, the compiler output should look something like this:

static_assert_linebreaks.d(1): static assert is false: An error message
        that spans multiple lines, and also contains such characters as a tab,
\ and ".


-- 
Jun 18 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1276






Oh, u need to define valid escape sequence usable in that static assert
specifically

consider:

static assert(false, "%s");

what supposed to be happen? surely not segfault or arbitrary strings.
so only \ leading ones need to be taken care of specially. while this
complicates the compiler. I doubt if walter would love to implement it
in the near future  :)


-- 
Jun 19 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1276






There is no escape sequence in the string "%s".  There are just two characters
- '%' and 's'.


-- 
Jun 19 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1276


onlystupidspamhere yahoo.se changed:

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





Fixed in 1.017.


-- 
Jun 26 2007