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

            Bug ID: 86342
           Summary: Wdeprecated-copy in a header included from system
                    directory
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: csaba_22 at yahoo dot co.uk
  Target Milestone: ---

Created attachment 44332
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44332&action=edit
preprocessor output from -save-temps

#include <boost/range/sub_range.hpp>
#include <string>
#include <vector>

using srange = boost::sub_range<std::string const>;

void func(srange) // by value
{}

int main()
{
    std::string  kitty{"meow"};
    srange hello{kitty};
    srange const& helref = hello;

    func(hello);
    func(helref); // line 17

    return 0;
}

$ g++ -v
gcc version 9.0.0 20180626 (experimental) (GCC)

$ g++ -Wall -pedantic -Wextra -Werror -save-temps subra.cpp
subra.cpp: In function ‘int main()’:
subra.cpp:17:13: error: implicitly-declared ‘constexpr
boost::sub_range<const std::__cxx11::basic_string<char>
>::sub_range(const boost::sub_range<const
std::__cxx11::basic_string<char> >&)’ is deprecated
[-Werror=deprecated-copy]
  func(helref);
             ^
In file included from subra.cpp:1:
/usr/include/boost/range/sub_range.hpp:259:20: note: because
‘boost::sub_range<const std::__cxx11::basic_string<char> >’ has
user-provided ‘boost::sub_range<ForwardRange>&
boost::sub_range<ForwardRange>::operator=(const
boost::sub_range<ForwardRange>&) [with ForwardRange = const
std::__cxx11::basic_string<char>]’
         sub_range& operator=( const sub_range& r )
                    ^~~~~~~~
subra.cpp:7:6: note:   initializing argument 1 of ‘void func(srange)’
 void func(srange) // by value
      ^~~~



sub_range.hpp is included from a system directory (under /usr/include), so it
should be exempt from this warning.

Reply via email to