[LLVMbugs] [Bug 22806] New: Move from destroyed object in tuple_cat of nested tuples
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Mar 5 08:35:13 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22806
Bug ID: 22806
Summary: Move from destroyed object in tuple_cat of nested
tuples
Product: libc++
Version: 3.6
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ldionne.2 at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
This bug concerns libc++ trunk (git-svn ID 230867).
In the following code, `Tracked{}` is destroyed and is then moved-from.
std::tuple_cat(std::make_tuple(std::make_tuple(Tracked{})));
Here's a self-contained test program:
#include <cassert>
#include <tuple>
struct Tracked {
enum class State { CONSTRUCTED, MOVED_FROM, DESTROYED };
State state;
Tracked() : state{State::CONSTRUCTED} { }
Tracked(Tracked const& t) : state{State::CONSTRUCTED} {
assert(t.state != State::MOVED_FROM && "copying a moved-from
object");
assert(t.state != State::DESTROYED && "copying a destroyed
object");
}
Tracked(Tracked&& t) : state{State::CONSTRUCTED} {
assert(t.state != State::MOVED_FROM && "double moving from an
object");
assert(t.state != State::DESTROYED && "moving from a destroyed
object");
t.state = State::MOVED_FROM;
}
~Tracked() {
assert(state != State::DESTROYED && "double-destroying an object");
state = State::DESTROYED;
}
};
int main() {
std::tuple_cat(std::make_tuple(std::make_tuple(Tracked{})));
}
Compiling and then running this will produce:
Assertion failed: (t.state != State::DESTROYED && "moving from a destroyed
object")
I don't have the time to investigate this further right now, unfortunately.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150305/7d397e3e/attachment.html>
More information about the llvm-bugs
mailing list