This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68954] New: [5/6 Regression] -Wdeprecated-declarations warns for system header templates


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68954

            Bug ID: 68954
           Summary: [5/6 Regression] -Wdeprecated-declarations warns for
                    system header templates
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

std::auto_ptr is marked as deprecated in
libstdc++-v3/include/backward/auto_ptr.h
and

#include <memory>

int main()
{
  int i;
  std::auto_ptr<int> x;
}

warns about this even without -Wsystem-headers.  What is worse, since GCC 5.3
adding -Werror makes this an error while with 5.2 it was a warning despite
-Werror:

> /space/rguenther/install/gcc-5.2/bin/g++ t.C -S -std=gnu++11  -Wdeprecated-declarations -Werror
t.C: In function 'int main()':
t.C:6:8: warning: 'template<class> class std::auto_ptr' is deprecated
[-Wdeprecated-declarations]
   std::auto_ptr<int> x;
        ^
In file included from
/home/space/rguenther/install/gcc-5.2/include/c++/5.2.0/memory:81:0,
                 from t.C:1:
/home/space/rguenther/install/gcc-5.2/include/c++/5.2.0/bits/unique_ptr.h:49:28note:
declared here
   template<typename> class auto_ptr;
                            ^

> /space/rguenther/install/gcc-5.3/bin/g++ t.C -S -std=gnu++11  -Wdeprecated-declarations -Werror
t.C: In function âint main()â:
t.C:6:8: error: âtemplate<class> class std::auto_ptrâ is deprecated
[-Werror=deprecated-declarations]
   std::auto_ptr<int> x;
        ^
In file included from
/home/space/rguenther/install/gcc-5.3/include/c++/5.3.0/memory:81:0,
                 from t.C:1:
/home/space/rguenther/install/gcc-5.3/include/c++/5.3.0/bits/unique_ptr.h:49:28note:
declared here
   template<typename> class auto_ptr;
                            ^
cc1plus: all warnings being treated as errors


Note that GCC 4.9 does not warn at all, not even with -Wsystem-headers.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]