• Branislav Katreniak's avatar
    capnp/test: add union in generic struct test - compilation error · 682cc0c5
    Branislav Katreniak authored
    Adding union into TestGenerics struct leads to compilation error
    in generated header:
    ````cpp
    In file included from external/capnproto/c++/src/capnp/test_capnp/capnp/test.capnp.c++:4:0:
    external/capnproto/c++/src/capnp/test_capnp/capnp/test.capnp.h:9565:10: error: need ‘typename’ before ‘capnproto_test::capnp::test::TestGenerics<Foo, Bar>::Ug::Reader’ because ‘capnproto_test::capnp::test::TestGenerics<Foo, Bar>::Ug’ is a dependent scope
       inline Ug::Reader getUg() const;
    ````
    Relavant parts in header file:
    
    ````cpp
    template <typename Foo = ::capnp::AnyPointer, typename Bar = ::capnp::AnyPointer>
    struct TestGenerics {
      ...
      struct Ug;
    };
    
    template <typename Foo, typename Bar>
    class TestGenerics<Foo, Bar>::Reader {
      ...
      inline Ug::Reader getUg() const;
    };
    ````
    
    Compiler misses `typename` keyword before Ug::Reader.
    682cc0c5
test.capnp 26.5 KB