Bug 55557 - no deprecated warning on the first std::auto_ptr
Summary: no deprecated warning on the first std::auto_ptr
Status: RESOLVED DUPLICATE of bug 33911
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-01 20:43 UTC by Igor Pashev
Modified: 2012-12-01 22:24 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-12-01 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Pashev 2012-12-01 20:43:38 UTC
Here is a C++ source code:

# cat -n test.cpp
 1  #include <memory>
 2  using namespace std;
 3   
 4  int main(int argc, char **argv)
 5  {
 6      auto_ptr<int> x;
 7      auto_ptr<int> y;
 8      auto_ptr<int> z;
 9   
10      return 0;
11  }

Command line to compile it with C++11 standard:
g++-4.7 -std=gnu++11 -Wall -Wextra -Wdeprecated-declarations  -pedantic test.cpp 

Here is the g++ output:
test.cpp: In function ‘int main(int, char**)’:
test.cpp:7:19: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.7/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
test.cpp:8:19: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.7/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
test.cpp: At global scope:
test.cpp:4:5: warning: unused parameter ‘argc’ [-Wunused-parameter]
test.cpp:4:5: warning: unused parameter ‘argv’ [-Wunused-parameter]

A warning about auto_ptr being deprecated has been issued only for y and z. I expect a warning for x too.

Moreover, if I leave only one auto_ptr (say, x) I will see no deprecation warning at all.

It is expected to see warning on every auto_ptr instantiation.
Comment 1 Igor Pashev 2012-12-01 20:46:12 UTC
# g++-4.7 --version
g++-4.7 (Debian 4.7.2-4) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 2 Paolo Carlini 2012-12-01 22:01:35 UTC
Weird, doesn't seem a regression though.
Comment 3 Paolo Carlini 2012-12-01 22:12:13 UTC
Well, this is the old PR33911: only, in that one Benjamin didn't notice that an additional:

goo<int> f2b;

finally gets the working.

*** This bug has been marked as a duplicate of bug 33911 ***