www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7270] New: Wrong writeln(T.stringof) with const

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

           Summary: Wrong writeln(T.stringof) with const
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2012-01-11 05:24:38 PST ---
import std.stdio;
void main() {
    alias const(const(int)[]) T;
    writeln(typeid(T));
    writeln(T.stringof);
    pragma(msg, T.stringof);
}



Output, DMD 2.058head:

const(int[])
const(const(int)[])
const(int[])


Expected output:

const(int[])
const(int[])
const(int[])

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7270


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Wrong writeln(T.stringof)   |Wrong writeln(typeid(T))
                   |with const                  |with const


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-01-11 06:42:09 PST ---
This is TypeInfo.toString problem.

import std.stdio;
void main() {
    alias const(const(int)[]) T;
    pragma(msg, "1: ", T.stringof);
    writeln("2: ", typeid(T));
    writeln("3: ", T.stringof);
}

Output:
----
1: const(int[])          // pragma + T.stringof
2: const(const(int)[])   // writeln + typeid(T) (== TypeInfo.toString())
3: const(int[])          // writeln + T.stringof

Changed the title.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7270


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |druntime


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2012-01-11 06:43:05 PST ---
And, this is druntime issue, not dmd's.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7270



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-26
07:16:34 PDT ---
*** Issue 4741 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7270



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-26
07:17:05 PDT ---
(In reply to comment #3)
 *** Issue 4741 has been marked as a duplicate of this issue. ***

See my comment in 4741 for more examples: http://d.puremagic.com/issues/show_bug.cgi?id=4741#c0 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 26 2013