Commit 6fc8a13
committed
C++11: fix downcast before calling
See kaitai-io/kaitai_struct#919 (comment)
Fixes the DebugSwitchUser test for C++11. Here's the diff in the
generated parser code:
```diff
--- 1/compiled-old/cpp_stl_11/debug_switch_user.cpp
+++ 2/compiled/cpp_stl_11/debug_switch_user.cpp
@@ -12,12 +12,12 @@ void debug_switch_user_t::_read() {
switch (code()) {
case 1: {
m_data = std::unique_ptr<one_t>(new one_t(m__io, this, m__root));
- static_cast<std::unique_ptr<one_t>>(m_data)->_read();
+ static_cast<one_t*>(m_data.get())->_read();
break;
}
case 2: {
m_data = std::unique_ptr<two_t>(new two_t(m__io, this, m__root));
- static_cast<std::unique_ptr<two_t>>(m_data)->_read();
+ static_cast<two_t*>(m_data.get())->_read();
break;
}
}
```_read() in --no-auto-read mode1 parent 157309f commit 6fc8a13
1 file changed
Lines changed: 10 additions & 9 deletions
File tree
Lines changed: 10 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| |||
738 | 739 | | |
739 | 740 | | |
740 | 741 | | |
741 | | - | |
| 742 | + | |
742 | 743 | | |
743 | 744 | | |
744 | 745 | | |
| |||
861 | 862 | | |
862 | 863 | | |
863 | 864 | | |
864 | | - | |
| 865 | + | |
865 | 866 | | |
866 | 867 | | |
867 | 868 | | |
| |||
1028 | 1029 | | |
1029 | 1030 | | |
1030 | 1031 | | |
1031 | | - | |
| 1032 | + | |
1032 | 1033 | | |
1033 | 1034 | | |
1034 | | - | |
| 1035 | + | |
1035 | 1036 | | |
1036 | 1037 | | |
1037 | 1038 | | |
1038 | | - | |
| 1039 | + | |
1039 | 1040 | | |
1040 | 1041 | | |
1041 | | - | |
| 1042 | + | |
1042 | 1043 | | |
1043 | | - | |
| 1044 | + | |
1044 | 1045 | | |
1045 | 1046 | | |
1046 | | - | |
| 1047 | + | |
1047 | 1048 | | |
1048 | 1049 | | |
1049 | 1050 | | |
| |||
0 commit comments