Commit 7a75898
Breaking change: Add a debug check that the target of CopyFrom is not a descendant of the source.
Previously, you were allowed to do the following:
```cc
MyMessage msg;
*msg.mutable_submessage() = msg;
```
However, this could leave the message in an inconsistent state in some contrived examples, and the order of operations is unclear and potentially compiler-dependent.
Instead, if you would like to do this, you should be explicit about the order of operations:
```cc
MyMessage msg;
MyMessage msg_copy = msg;
*msg.mutable_submessage() = std::move(msg_copy);
```
PiperOrigin-RevId: 8204621561 parent af3430c commit 7a75898
File tree
4 files changed
+0
-9
lines changed- src/google/protobuf
- compiler/cpp
4 files changed
+0
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4702 | 4702 | | |
4703 | 4703 | | |
4704 | 4704 | | |
4705 | | - | |
4706 | 4705 | | |
4707 | 4706 | | |
4708 | 4707 | | |
4709 | | - | |
4710 | 4708 | | |
4711 | 4709 | | |
4712 | 4710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | 160 | | |
165 | 161 | | |
166 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| |||
0 commit comments