Thread overview | |||||
---|---|---|---|---|---|
|
July 07, 2010 [Issue 4436] New: Double bug regarding Tuple.init | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4436 Summary: Double bug regarding Tuple.init Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: andrei@metalanguage.com --- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-07-07 13:39:18 PDT --- Consider: import std.stdio, std.typecons; struct S { this(this) { writeln("making a copy"); } } void main() { Tuple!(S, int) x; auto p1 = &(x.init); //auto p2 = &(Tuple!(S, int).init); } The program as is calls the copy constructor of S twice. It should call none (for at least two reasons: effciency and the fact that some types want to disable copying). Furthermore, uncommenting the last line in main yields a compile-time error. It should compile and run (again without invoking the copy constructor). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 31, 2012 [Issue 4436] Double bug regarding Tuple.init | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4436 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-30 18:55:00 PDT --- (In reply to comment #0) > Consider: > > import std.stdio, std.typecons; > > struct S > { > this(this) { writeln("making a copy"); } > } > > void main() { > Tuple!(S, int) x; > auto p1 = &(x.init); > //auto p2 = &(Tuple!(S, int).init); > } > > The program as is calls the copy constructor of S twice. It should call none (for at least two reasons: effciency and the fact that some types want to disable copying). > > Furthermore, uncommenting the last line in main yields a compile-time error. It should compile and run (again without invoking the copy constructor). From 2.059, T.init always returns rvalue even if T is struct. So getting address of init property by & operator is rejected in compile. I think this issue should be closed with the status "resolved invalid". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 27, 2013 [Issue 4436] Double bug regarding Tuple.init | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4436 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-26 23:13:10 PDT --- (In reply to comment #1) > I think this issue should be closed with the status "resolved invalid". The explained behavior was actually a bug, so it didn't invalid. I'll mark this "fixed". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation