Re: std::auto_ptr deprecation warning in libstdc++ 5.1

See, especially comment 9.

This particular instance of std::auto_ptr will be replaced by a plain old pointer in future releases of glibmm. It's static data, intended to be used only by a few glibmm classes.


Den 2015-05-04 00:15, Marcin Kolny skrev:
It's actually not a solution of your problem, because you have to change compilation flags,
but you can use following ifdefs block:
#if __cplusplus < 201103L
  // use auto_ptr
  // use unique_ptr
and compile glibmm with -std=c++11 flag. As I said, it's not a solution, but just a workaround.
I believe, that breaking glibmm's ABI/API is inevitable anyway, so maybe time has come to
enable c++11 flag by default and use c++11 features in glibmm?

2015-05-04 0:00 GMT+02:00 Andrew Potter <agpotter gmail com>:
Hi everybody,

As you probably know, std::auto_ptr got deprecated in the C++11
standard and is scheduled for removal in C++17. After upgrading to
Fedora 22, I see that g++ is now issuing a warning when it sees use of
std::auto_ptr. Unfortunately there is one in glibmm's objectbase.h:

In file included from /usr/include/glibmm-2.4/glibmm/object.h:29:0,
                 from /usr/include/giomm-2.4/giomm/simpleaction.h:27,
                 from application.cpp:19:
/usr/include/glibmm-2.4/glibmm/objectbase.h:215:13: warning:
‘template<class> class std::auto_ptr’ is deprecated
 static std::auto_ptr<Threads::Mutex> extra_object_base_data_mutex;
In file included from /usr/include/c++/5.1.1/memory:81:0,
                 from /usr/include/glibmm-2.4/glibmm/objectbase.h:32,
                 from /usr/include/glibmm-2.4/glibmm/object.h:29,
                 from /usr/include/giomm-2.4/giomm/simpleaction.h:27,
                 from application.cpp:19:
/usr/include/c++/5.1.1/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;

I don't think this is fully resolvable until the next ABI/API break
(which maybe we should think about in the 2017 timeframe?), but in the
meantime, does anyone have a clever idea to hide this particular
warning without disabling -Wdepreciated-declarations altogether? Or
maybe we can make some ABI-compatible Glib::auto_ptr ?

Marcin Kolny

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]