{"action":"closed","issue":{"url":"https://api.github.com/repos/swig/swig/issues/497","repository_url":"https://api.github.com/repos/swig/swig","labels_url":"https://api.github.com/repos/swig/swig/issues/497/labels{/name}","comments_url":"https://api.github.com/repos/swig/swig/issues/497/comments","events_url":"https://api.github.com/repos/swig/swig/issues/497/events","html_url":"https://github.com/swig/swig/issues/497","id":100189621,"number":497,"title":"Swig Creates Uninitialized Referenc on the Stack.","user":{"login":"mehoggan","id":904966,"avatar_url":"https://avatars.githubusercontent.com/u/904966?v=3","gravatar_id":"","url":"https://api.github.com/users/mehoggan","html_url":"https://github.com/mehoggan","followers_url":"https://api.github.com/users/mehoggan/followers","following_url":"https://api.github.com/users/mehoggan/following{/other_user}","gists_url":"https://api.github.com/users/mehoggan/gists{/gist_id}","starred_url":"https://api.github.com/users/mehoggan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehoggan/subscriptions","organizations_url":"https://api.github.com/users/mehoggan/orgs","repos_url":"https://api.github.com/users/mehoggan/repos","events_url":"https://api.github.com/users/mehoggan/events{/privacy}","received_events_url":"https://api.github.com/users/mehoggan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-08-10T23:17:15Z","updated_at":"2016-08-04T23:55:51Z","closed_at":"2016-08-04T23:55:51Z","body":"Using version 3.0.7 of swig I get the following build errors when using a std::vector<boost::intrusive_ptr<const T>> , wher boost::intrusive_ptr<const T> is typedefed as ConstTPtr.\r\n\r\n/home/mhoggan/Devel/Earthscape/soft/src/EarthCore/EarthCoreOpsApi/Swig/Rtl_EarthCoreOpsApiJava.cpp:57333:74: error: ‘result’ declared as reference but not initialized\r\n   std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference result;^M\r\n                                                                          ^\r\n/home/mhoggan/Devel/Earthscape/soft/src/EarthCore/EarthCoreOpsApi/Swig/Rtl_EarthCoreOpsApiJava.cpp:57341:12: error: passing ‘const value_type {aka const boost::intrusive_ptr<const EarthScape::Core::ResultDetail>}’ as ‘this’ argument of ‘boost::intrusive_ptr<T>& boost::intrusive_ptr<T>::operator=(const boost::intrusive_ptr<T>&) [with T = const EarthScape::Core::ResultDetail]’ discards qualifiers [-fpermissive]\r\n     result = std_vector_Sl_EarthScape_Core_ConstResultDetailPtr_Sg__get(arg1,arg2);^M\r\n            ^\r\n/home/mhoggan/Devel/Earthscape/soft/src/EarthCore/EarthCoreOpsApi/Swig/Rtl_EarthCoreOpsApiJava.cpp:57348:77: error: cannot declare pointer to ‘std::vector<boost::intrusive_ptr<const EarthScape::Core::ResultDetail> >::const_reference {aka const class boost::intrusive_ptr<const EarthScape::Core::ResultDetail>&}’\r\n   *(std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference **)&jresult = new std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference((const std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference &)result); ^M\r\n                                                                             ^\r\n/home/mhoggan/Devel/Earthscape/soft/src/EarthCore/EarthCoreOpsApi/Swig/Rtl_EarthCoreOpsApiJava.cpp:57348:251: error: new cannot be applied to a reference type\r\n   *(std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference **)&jresult = new std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference((const std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference &)result);\r\n\r\nThe resulting code looking like:\r\n\r\nSWIGEXPORT jlong JNICALL Java_nokia_earthcore_earthcoreopsapi_EarthCoreOpsApiModuleJNI_VectorResultDetailPtr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {\r\n  jlong jresult = 0 ;\r\n  std::vector< EarthScape::Core::ConstResultDetailPtr > *arg1 = (std::vector< EarthScape::Core::ConstResultDetailPtr > *) 0 ;\r\n  int arg2 ;\r\n  std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference result;\r\n\r\n  (void)jenv;\r\n  (void)jcls;\r\n  (void)jarg1_;\r\n  arg1 = *(std::vector< EarthScape::Core::ConstResultDetailPtr > **)&jarg1;\r\n  arg2 = (int)jarg2;\r\n  try {\r\n    result = std_vector_Sl_EarthScape_Core_ConstResultDetailPtr_Sg__get(arg1,arg2);\r\n  }\r\n  catch(std::out_of_range &_e) {\r\n    SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what());\r\n    return 0;\r\n  }\r\n\r\n  *(std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference **)&jresult = new std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference((const std::vector< EarthScape::Core::ConstResultDetailPtr >::const_reference &)result);\r\n  return jresult;\r\n}\r\n\r\nFor more details please contact:\r\nmatthew.hoggan@here.com\r\n"}}
{"actor":{"display_login":"ojwb"}}