digitalmars.D - seg fault due to a ref parameter with default value
- Rob T (11/11) Mar 20 2013 void f( ref string a = "" )
- bearophile (4/5) Mar 20 2013 I don't see a crash (Win 32) but it should not compile.
- Rob T (5/10) Mar 20 2013 I'm running it on Linux 64 with compiler optimizations enabled.
- Jonathan M Davis (4/17) Mar 20 2013 Of course it shouldn't compile. It's clearly an "accepts-invalid" bug.
- Rob T (1/1) Mar 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9773
- deadalnix (3/14) Mar 20 2013 I don't think "" should be an lvalue, so it should bind to ref
void f( ref string a = "" ) { a = "crash and burn"; } main() { f(); // seg fault. This should not even compile. } I did not see a bug report on this one, but maybe I missed it. Any comments before I submit a bug report? --rt
Mar 20 2013
Rob T:Any comments before I submit a bug report?I don't see a crash (Win 32) but it should not compile. Bye, bearophile
Mar 20 2013
On Thursday, 21 March 2013 at 00:30:41 UTC, bearophile wrote:Rob T:I'm running it on Linux 64 with compiler optimizations enabled. I think the solution to the problem is that it simply should not compile. --rtAny comments before I submit a bug report?I don't see a crash (Win 32) but it should not compile. Bye, bearophile
Mar 20 2013
On Thursday, March 21, 2013 05:07:14 Rob T wrote:On Thursday, 21 March 2013 at 00:30:41 UTC, bearophile wrote:Of course it shouldn't compile. It's clearly an "accepts-invalid" bug. Literals aren't lvalues, and ref only accepts lvalues. - Jonathan M DavisRob T:I'm running it on Linux 64 with compiler optimizations enabled. I think the solution to the problem is that it simply should not compile.Any comments before I submit a bug report?I don't see a crash (Win 32) but it should not compile. Bye, bearophile
Mar 20 2013
On Wednesday, 20 March 2013 at 23:12:37 UTC, Rob T wrote:void f( ref string a = "" ) { a = "crash and burn"; } main() { f(); // seg fault. This should not even compile. } I did not see a bug report on this one, but maybe I missed it. Any comments before I submit a bug report? --rtI don't think "" should be an lvalue, so it should bind to ref parameter in the first place.
Mar 20 2013