[Issue 10827] New: Erroneous default string argument for a char[] type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 15 12:20:11 PDT 2013


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 at puremagic.com
        ReportedBy: maxim at maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim at 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: -------


More information about the Digitalmars-d-bugs mailing list