Compiler warns about 'reference to temporary' with iterator on shared memory map

Hello, Consider: typedef std::pair<int, int> value_type; typedef allocator<value_type, managed_shared_memory::segment_manager> ValueAllocator; typedef boost::interprocess::map<int, int, std::less<int>, ValueAllocator> A_map; class A { public: A() { /* Construct shared memory map */ } ~A() bool contains(int i); private: A_map* m_objA; }; inline bool A::contains(int i) { A_map::iterator itr = m_objA->find(i); return (itr != m_objA->end()); } Here, at the line A_map::iterator itr = m_objA->find(i); I see this warning: .../boost_1_49_0/include/boost/container/detail/tree.hpp:391:31: warning: returning reference to temporary [enabled by default] I dont see a reason for this. Can someone please point out if I am doing something wrong here? Thanks in advance, Regards, Raj -- Twitter: @Blismobile <http://twitter.com/#!/blismobile> BlisMobile Media 32 Percy Street, London W1T 2DE www.blismobile.com [image: BlisMobile] <http://www.blismobile.com/>[image: Follow on Twitter]<http://twitter.com/#!/blismobile>[image: Blis Website] <http://www.blismobile.com/> This communication is from BlisMobile Media, which is a trading name of Breeze Tech (UK) Ltd, a company registered in England and Wales with registered number 06455773. Its registered office is 32 Percy Street, London W1T 2DE, United Kingdom. This communication contains information that is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please (1) notify info@blismobile.com by forwarding this email and delete all copies from your system and (2) note that disclosure, distribution, copying or use of this communication is strictly prohibited. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a Blismobile email account are securely archived and stored by an external supplier. This email does not constitute a contractual agreement; such agreements are in specified contractual or Insertion Order (IO) form only and exclusively contain all the terms to which Breeze Tech )UK) Ltd will be bound. To the extent permitted by law, Breeze Tech (UK) Ltd does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a contract or Insertion Order. Opinions, conclusions and other information in this email which have not been delivered by way of the business of Breeze Tech (UK) Ltd are neither given nor endorsed by it.

I can't see any problem. Can you give a full compilable example and your compiler version? Best, Ion

Hi Ion, Sorry for the delay in reply. Please find attached the sample code (header and cpp file) and the build log. Thanks for your help. Regards, Raj 2012/4/16 Ion Gaztañaga <igaztanaga@gmail.com>
I can't see any problem. Can you give a full compilable example and your compiler version?
Best,
Ion ______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**users<http://lists.boost.org/mailman/listinfo.cgi/boost-users>
-- Twitter: @Blismobile <http://twitter.com/#!/blismobile> BlisMobile Media 32 Percy Street, London W1T 2DE www.blismobile.com [image: BlisMobile] <http://www.blismobile.com/>[image: Follow on Twitter]<http://twitter.com/#!/blismobile>[image: Blis Website] <http://www.blismobile.com/> This communication is from BlisMobile Media, which is a trading name of Breeze Tech (UK) Ltd, a company registered in England and Wales with registered number 06455773. Its registered office is 32 Percy Street, London W1T 2DE, United Kingdom. This communication contains information that is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please (1) notify info@blismobile.com by forwarding this email and delete all copies from your system and (2) note that disclosure, distribution, copying or use of this communication is strictly prohibited. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a Blismobile email account are securely archived and stored by an external supplier. This email does not constitute a contractual agreement; such agreements are in specified contractual or Insertion Order (IO) form only and exclusively contain all the terms to which Breeze Tech )UK) Ltd will be bound. To the extent permitted by law, Breeze Tech (UK) Ltd does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a contract or Insertion Order. Opinions, conclusions and other information in this email which have not been delivered by way of the business of Breeze Tech (UK) Ltd are neither given nor endorsed by it.

A further update on this : The same code works well without any warnings and errors on Boost 1.46.1 (that is available @ /usr/include on Ubuntu). The errors and warnings I am seeing are when building with Boost 1.49.0. Thanks, Raj On 23 April 2012 16:21, Rajalakshmi Iyer <raj@blismobile.com> wrote:
Hi Ion,
Sorry for the delay in reply.
Please find attached the sample code (header and cpp file) and the build log.
Thanks for your help.
Regards, Raj
2012/4/16 Ion Gaztañaga <igaztanaga@gmail.com>
I can't see any problem. Can you give a full compilable example and your compiler version?
Best,
Ion ______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**users<http://lists.boost.org/mailman/listinfo.cgi/boost-users>
-- Twitter: @Blismobile <http://twitter.com/#!/blismobile> BlisMobile Media 32 Percy Street, London W1T 2DE www.blismobile.com [image: BlisMobile] <http://www.blismobile.com/>[image: Follow on Twitter]<http://twitter.com/#!/blismobile>[image: Blis Website] <http://www.blismobile.com/> This communication is from BlisMobile Media, which is a trading name of Breeze Tech (UK) Ltd, a company registered in England and Wales with registered number 06455773. Its registered office is 32 Percy Street, London W1T 2DE, United Kingdom. This communication contains information that is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please (1) notify info@blismobile.com by forwarding this email and delete all copies from your system and (2) note that disclosure, distribution, copying or use of this communication is strictly prohibited. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a Blismobile email account are securely archived and stored by an external supplier. This email does not constitute a contractual agreement; such agreements are in specified contractual or Insertion Order (IO) form only and exclusively contain all the terms to which Breeze Tech )UK) Ltd will be bound. To the extent permitted by law, Breeze Tech (UK) Ltd does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a contract or Insertion Order. Opinions, conclusions and other information in this email which have not been delivered by way of the business of Breeze Tech (UK) Ltd are neither given nor endorsed by it.

El 23/04/2012 17:44, Rajalakshmi Iyer escribió:
A further update on this :
The same code works well without any warnings and errors on Boost 1.46.1 (that is available @ /usr/include on Ubuntu).
The errors and warnings I am seeing are when building with Boost 1.49.0.
Thanks for the report. Best, Ion

El 23/04/2012 17:44, Rajalakshmi Iyer escribió:
A further update on this :
The same code works well without any warnings and errors on Boost 1.46.1 (that is available @ /usr/include on Ubuntu).
The errors and warnings I am seeing are when building with Boost 1.49.0.
Can you tell me your compiler version so that I can test it in a similar compiler/version? Best, Ion

Hi Ion, Sorry for the delay in replying. Here is the information you asked for : # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/ gcc/x86_64-linux-gnu/4.6.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) I am working on Ubuntu 11.10. Thanks, Raj On Thu, Apr 26, 2012 at 6:06 PM, Ion Gaztañaga <igaztanaga@gmail.com> wrote:
The same code works well without any warnings and errors on Boost 1.46.1 (that is available @ /usr/include on Ubuntu).
The errors and warnings I am seeing are when building with Boost 1.49.0.
Can you tell me your compiler version so that I can test it in a similar compiler/version?
Best,
Ion ______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**users<http://lists.boost.org/mailman/listinfo.cgi/boost-users>
-- Twitter: @Blismedia <http://twitter.com/#%21/blismobile> BlisMedia 32 Percy Street, London W1T 2DE www.blismedia.com <http://www.blismobile.com/> <http://www.blismobile.com/> [image: Follow on Twitter] <http://twitter.com/#%21/blismobile>[image: Blis Website] <http://www.blismobile.com/> This communication is from BlisMedia, which is a trading name of Breeze Tech (UK) Ltd, a company registered in England and Wales with registered number 06455773. Its registered office is 32 Percy Street, London W1T 2DE, United Kingdom. This communication contains information that is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please (1) notify info@blismedia.com<info@blismobile.com> by forwarding this email and delete all copies from your system and (2) note that disclosure, distribution, copying or use of this communication is strictly prohibited. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a Blismobile email account are securely archived and stored by an external supplier. This email does not constitute a contractual agreement; such agreements are in specified contractual or Insertion Order (IO) form only and exclusively contain all the terms to which Breeze Tech )UK) Ltd will be bound. To the extent permitted by law, Breeze Tech (UK) Ltd does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a contract or Insertion Order. Opinions, conclusions and other information in this email which have not been delivered by way of the business of Breeze Tech (UK) Ltd are neither given nor endorsed by it.
participants (3)
-
Ion Gaztañaga
-
Rajalakshmi Iyer
-
Rajalakshmi Iyer