fix endless recursion on copy initialisation from Ref
The Ref-GenNode is just a specifically constructed GenNode, and intended to be sliced down to an ordinary GenNode immediately after construction. It seems, GCC didn't "get that" and instead emitted an recursive invocation of the same ctor, which obviously leads to stack overflow. Problem solved by explicitly coding the copy initialisation, after the full definition of Ref is available.
This commit is contained in:
parent
0e769601b7
commit
9267b57c54
1 changed files with 10 additions and 4 deletions
|
|
@ -254,10 +254,10 @@ namespace diff{
|
|||
////////////////////////TICKET #963 Forwarding shadows copy operations -- generic solution??
|
||||
GenNode(GenNode const&) =default;
|
||||
GenNode(GenNode&&) =default;
|
||||
GenNode(GenNode& o) : GenNode((GenNode const&)o) { }
|
||||
GenNode(Ref const& r) : GenNode((GenNode const&)r) { }
|
||||
GenNode(Ref & r) : GenNode((GenNode const&)r) { }
|
||||
GenNode(Ref && r) : GenNode((GenNode &&)r) { }
|
||||
GenNode(GenNode& o) : GenNode((GenNode const&)o) { }
|
||||
GenNode(Ref const& r);
|
||||
GenNode(Ref & r);
|
||||
GenNode(Ref && r);
|
||||
|
||||
GenNode& operator= (GenNode const&) =default;
|
||||
GenNode& operator= (GenNode&&) =default;
|
||||
|
|
@ -601,6 +601,12 @@ namespace diff{
|
|||
};
|
||||
|
||||
|
||||
// slice down on copy construction...
|
||||
inline GenNode::GenNode(Ref const& r) : idi(r.idi), data(r.data) { }
|
||||
inline GenNode::GenNode(Ref & r) : idi(r.idi), data(r.data) { }
|
||||
inline GenNode::GenNode(Ref && r) : idi(std::move(r.idi)),
|
||||
data(std::move(r.data)) { }
|
||||
|
||||
|
||||
/* === Specialisation to add fluent GenNode builder API to Record<GenNode> === */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue