Bug 10827 – Erroneous default string argument for a char[] type

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-15T12:20:00Z
Last change time
2015-06-09T05:15:08Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
maxim

Comments

Comment #0 by maxim — 2013-08-15T12:20:10Z
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.