From 3d40c7ed7d86c2afd111fee4f2d7bc3c3d0d62d6 Mon Sep 17 00:00:00 2001 From: postman01 Date: Thu, 3 Aug 2023 09:25:55 +0800 Subject: [PATCH] bug fix --- ch19/ex19_21_22_23_24_25.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch19/ex19_21_22_23_24_25.cpp b/ch19/ex19_21_22_23_24_25.cpp index df36a9545..e55d51a43 100644 --- a/ch19/ex19_21_22_23_24_25.cpp +++ b/ch19/ex19_21_22_23_24_25.cpp @@ -46,8 +46,8 @@ void Token::copyUnion(Token&& t){ switch (t.tok) { case INT : ival = t.ival; break; case CHAR : cval = t.cval; break; - case STR : std::move(t.sval);break; - case SAL : std::move(t.item); break; + case STR : new(&sval) string(std::move(t.sval));break; + case SAL : new(&item) Sales_data(std::move(t.item)); break; } } void Token::copyUnion(const Token &t){