Problem with struct mapping with forward declared types usage with C++23
-
Key: IDL4CPP11-35
-
Status: open Implementation work Blocked
-
Source: Remedy IT ( Johnny Willemsen)
-
Summary:
When using the IDL
struct AA; typedef sequence<AA> AASeq; struct BB { AASeq aa_; }; typedef sequence<BB> BBSeq; struct AA { BBSeq bb_; };
And compile this to C++ code according to the mapping, with C++23 clang this doesn't compile, the mapped C++ code as far as I can determine should be:
#include <vector> struct AA; using AASeq = std::vector<::AA>; struct BB { ::AASeq aa_{}; };// BB using BBSeq = std::vector<::BB>; struct AA { ::BBSeq bb_{}; };// AA
But with clang20 with C++23 enabled this gives
In file included from <source>:1: In file included from /opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/vector:66: /opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/bits/stl_vector.h:369:35: error: arithmetic on a pointer to an incomplete type 'AA' 369 | _M_impl._M_end_of_storage - _M_impl._M_start); | ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ /opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/bits/stl_vector.h:531:7: note: in instantiation of member function 'std::_Vector_base<AA, std::allocator<AA>>::~_Vector_base' requested here 531 | vector() = default; | ^ <source>:9:14: note: in defaulted default constructor for 'std::vector<AA>' first required here 9 | ::AASeq aa_{}; | ^ <source>:3:8: note: forward declaration of 'AA' 3 | struct AA; | ^ 1 error generated. Compiler returned: 1
-
Reported: IDL4-CPP 1.0 — Thu, 14 Aug 2025 12:05 GMT
-
Updated: Mon, 18 Aug 2025 19:29 GMT