www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10827] New: Erroneous default string argument for a char[] type

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

           Summary: Erroneous default string argument for a char[] type
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: maxim maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim maxim-fomin.ru> 2013-08-15 12:20:10 PDT
---
Originally detected in issue 10723

struct File
{
    private struct Impl
    {
        uint refs = uint.max / 2;
    }
    private Impl* _p;
    private string _name;

    this(string name, in char[] stdioOpenmode = "")
    {
       _p = new Impl();
       _p.refs = 1;
       throw new Exception(name);
    }

    ~this() {
        assert(_p.refs);
        --_p.refs;
        _p = null;
    }

    int byLine() {
        return 0;
    }
}

void main() {
    try {
        int f = File("It's OK").byLine();
    } catch(Exception e) { }
}

Code "in char[] stdioOpenmode = """ shouldn't be compiled.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10827


Maxim Fomin <maxim maxim-fomin.ru> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2013