Skip to content

Examples compilation errors (related to opensplice) when using VS2015 final release. #43

Closed

Description

@j-rivero

We are getting a new error, seems like it was not present on VS2015 RC (14.0.22816.0) nor other compilers, when compiling the examples with the final (both Express and Professional) VS2015.

The error in jenkins:

c:\jenkins\workspace\ros2_batch_ci_windows\workspace\build\example_interfaces\rosidl_typesupport_opensplice_cpp\example_interfaces\srv\dds_opensplice\AddTwoInts_Request_Dcps_impl.h(32): 
error C2248: 'DDS::TypeSupportFactory::TypeSupportFactory': cannot access private member declared in class 'DDS::TypeSupportFactory' [C:\Jenkins\workspace\ros2_batch_ci_windows\workspace\build\example_interfaces

Looks like a typical error of accessing to a default constructor under insufficient permission.

Probably the high level is placed in our examples code is being generated from the examples interfaces IDL code which generates the Sample_AddTwoInts_Response_Dcps_impl.h (this file appears explicitly in the error message) containing:

class ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC_example_interfaces Sample_AddTwoInts_Response_TypeSupportFactory : public ::DDS::TypeSupportFactory_impl
            {
            public:
                Sample_AddTwoInts_Response_TypeSupportFactory() {}
                virtual ~Sample_AddTwoInts_Response_TypeSupportFactory() {}
            private:
                ::DDS::DataWriter_ptr
                create_datawriter (gapi_dataWriter handle);

                ::DDS::DataReader_ptr
                create_datareader (gapi_dataReader handle);

                ::DDS::DataReaderView_ptr
                create_view (gapi_dataReaderView handle);
}; <-- line 32

This class inherited DDS::TypeSupportFactory_impl class. All the code seems sane to me here. The error does not point to this clase but the base class, DDS::TypeSupportFactory which defined the default constructor to protected.

I could imaging two source of errors, if my approaching is right: a compiler bug that got introduced in the last changes of VS 2015 final release or not a bug, but a feature, in the sense of stricter rule for visibility permissions on class inheritance that requires fixes in the code (I can not see which ones).

Activity

  1. j-rivero commented on Aug 7, 2015

    @j-rivero
    Author

    I tried to reproduce the inheritance structure to quick check but it compiles fine (cl /EHsc foo.ccp).

    class TypeSupportFactory
    {
       protected:
          TypeSupportFactory () {};
          ~TypeSupportFactory () {};
       private:
          TypeSupportFactory (const TypeSupportFactory &) {};
          TypeSupportFactory & operator = (const TypeSupportFactory &) {};
    };
    
    class TypeSupportFactory_impl :
        public TypeSupportFactory
    {
        public:
            TypeSupportFactory_impl() {};
            virtual ~TypeSupportFactory_impl() {};
    };
    
    class Interface :
        public TypeSupportFactory_impl
    {
    
        public:
            Interface () {};
    };
    
    int main()   
    {
        Interface foo;
        return 1;
    }
  2. dirk-thomas commented on Aug 7, 2015

    @dirk-thomas
    Member

    Afaik this is valid code until you try to either copy construct foo or use the assignment operator on it. You could try adding either of the fofllowing which will let the compiler generate the default versions of these functions:

    Interface bar(foo);
    

    or

    Interface bar = foo;
    
  3. j-rivero commented on Aug 7, 2015

    @j-rivero
    Author

    Afaik this is valid code until you try to either copy construct foo or use the assignment operator on it.

    I think so. Looks like other projects are suffering from the same problem which was caused by a new implementation of the STL library (move semantics went into it). So not really a compiler bug. Seems like we need to patch Opensplice code and give it a try.

  4. dirk-thomas commented on Aug 8, 2015

    @dirk-thomas
    Member

    Closing this - see latest comment on ros2/ros2#72.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions