Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1840

[cpp] Nested complex types fail compilation with "incomplete type" error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • cpp-binding

    Description

      When using nested complex types (for example, a list of maps or an array of lists), the compiler fails to compile. For example, the following code snippet (saved as ctt.cpp):

      #include <map>
      #include <vector>
      #include <proton/types.hpp>
      
      int main(int, char**) {
          std::map<proton::value, proton::value> m1 = {{uint8_t(0), "zero"}, {uint8_t(1), "one"}};
          std::map<proton::value, proton::value> m2 = {{true, "true"}, {false, "false"}};
          std::vector<std::map<proton::value, proton::value> > am = {m1, m2};
          proton::value pv = am;
      }

      fails compilation with the following error:

      In file included from install/include/proton/types.hpp:47:0,
      from ctt.cpp:3:
      install/include/proton/./codec/vector.hpp: In instantiation of ‘proton::codec::encoder& proton::codec::operator<<(proton::codec::encoder&, const std::vector<_Tp, _Alloc>&) [with T = std::map<proton::value, proton::value>; A = std::allocator<std::map<proton::value, proton::value> >]’:
      install/include/proton/./value.hpp:84:11: required from ‘typename proton::value::assignable<T, proton::value&>::type proton::value::operator=(const T&) [with T = std::vector<std::map<proton::value, proton::value> >; typename proton::value::assignable<T, proton::value&>::type = proton::value&]’
      install/include/proton/./value.hpp:79:85: required from ‘proton::value::value(const T&, typename proton::value::assignable<T>::type*) [with T = std::vector<std::map<proton::value, proton::value> >; typename proton::value::assignable<T>::type = void]’
      ctt.cpp:9:24: required from here
      install/include/proton/./codec/vector.hpp:39:31: error: incomplete type ‘proton::internal::type_id_of<std::map<proton::value, proton::value> >’ used in nested name specifier
          return e << encoder::array(x, internal::type_id_of<T>::value);
                      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kpvdr Kim van der Riet
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: