digitalmars.D.bugs - [Issue 8413] New: enforce breaks compilation of property function
- d-bugmail puremagic.com (34/34) Jul 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8413
- d-bugmail puremagic.com (21/21) Jul 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8413
- d-bugmail puremagic.com (12/12) Jul 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8413
- d-bugmail puremagic.com (7/7) Jul 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8413
- d-bugmail puremagic.com (10/10) Jul 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8413
- d-bugmail puremagic.com (11/11) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8413
http://d.puremagic.com/issues/show_bug.cgi?id=8413 Summary: enforce breaks compilation of property function Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 14:56:18 PDT --- struct Foo { int[] arr; property int front(string file = __FILE__, size_t line = __LINE__)() { enforce(arr.length, format("%s(%s): Cannot call back on empty array.", file, line)); return arr.front; } } void main() { Foo foo; auto x = foo.front; } test.d(28): Error: cannot resolve type for foo.front(string file = __FILE__,uint line = __LINE__) If you remove enforce it compiles with no problems. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8413 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|enforce breaks compilation |function breaks compilation |of property function |of property function 14:59:23 PDT --- Actually it has nothing to do with enforce, same error: void test(bool) { } struct Foo { int[] arr; property int front(string file = __FILE__, size_t line = __LINE__)() { test(arr.length); return arr.front; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8413 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PDT --- The error is correct. The fact that you gave front's parameters default arguments has _zero_ affect on its type, and its the type that determines whether the function can be property or not. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8413 PDT --- Oh wait. I read that wrong. I thought that you were passing them as function arguments. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8413 PDT --- For this to make sense return arr.front!("hello", 12) would have to make sense for a property, and I don't know if that makes sense or not. Probably not, since you couldn't do that if front were a public variable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8413 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME 14:48:30 PDT --- Works in 2.063.2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2013