How to turn on deprecated messages in g++?

I'm using g++ 4.8.1 on Ubuntu 10.

1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <memory>

int main()
{
    std::auto_ptr<int> a(new int(5));
    std::cout << *a << std::endl;

    return 0;
}


I tried to compile this test program and expected to get a message that std::auto_ptr is deprecated. To my surprise it compiled successfully without any warning. Adding -Wall or -Wdeprecated options didn't help. Am I missing something?
Last edited on
Am I missing something?
Yes.

The compiler is concerned with compiler features.
http://gcc.gnu.org/onlinedocs/gcc/Deprecated-Features.html

But you can deprecate your own stuff yourself.
http://stackoverflow.com/questions/295120/c-mark-as-deprecated

Older library stuff seems have fallen thru the cracks.
use of a deprecated library or language component is not a required diagnostic, it is a quality of implementation issue. Submit a bug report to gcc ( technically libstdc++, in this case), if you feel that this is wrong (I'd say this is at least inconsistent: things that were deprecated in 98 do print warnings at compile time in libsdc++)
Last edited on
Thanks for the responses. I was hoping to compile my 8 years old C++ project with new (C++11) compiler, get deprecated warnings and quickly fix them. But it seems the things are not that easy.
There are some breaking changes in C++11, but by and large code is expected to be forward compatible. Don't make work, just do what you need.
Topic archived. No new replies allowed.