Opened 11 years ago

Closed 11 years ago

#5958 closed Bugs (fixed)

Passing an argument of non-POD class type boost::match_results through ellipsis

Reported by: "LeJacq, Jean Pierre" <jeanpierre.lejacq@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.47.0 Severity: Problem
Keywords: POD Cc:

Description

boost::regex_replace() is implemented using the any_type struct that has a single constructor that has ellipsis as the argument type. The non-POD type boost::match_results is passed to the any_type constructor.

I believe this violates the standard (section 5.2.2 para 7. In particular, "If the argument has a non-POD class type (clause 9), the behavior is undefined."

This issue was detected with the IBM compiler XL C/C++ 11.1.0.3 with the following diagnostic:

"boost/regex/v4/regex_format.hpp", line 912.67: 1540-2924 (W) Cannot pass an argument of non-POD class type "boost::match_results<std::_Ptrit<char,long,const char *,const char &,char *,char &>,std::allocator<boost::sub_match<std::_Ptrit<char,long,const char *,const char &,char *,char &> > > >" through ellipsis. "boost/regex/v4/regex_format.hpp", line 912.73: 1540-2924 (W) Cannot pass an argument of non-POD class type "boost::match_results<std::_Ptrit<char,long,const char *,const char &,char *,char &>,std::allocator<boost::sub_match<std::_Ptrit<char,long,const char *,const char &,char *,char &> > > >" through ellipsis. "boost/regex/v4/regex_format.hpp", line 912.76: 1540-2924 (W) Cannot pass an argument of non-POD class type "boost::re_detail::string_out_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >" through ellipsis. "boost/regex/v4/regex_format.hpp", line 912.84: 1540-2924 (W) Cannot pass an argument of non-POD class type "boost::match_results<std::_Ptrit<char,long,const char *,const char &,char *,char &>,std::allocator<boost::sub_match<std::_Ptrit<char,long,const char *,const char &,char *,char &> > > >" through ellipsis. "boost/regex/v4/regex_format.hpp", line 912.87: 1540-2924 (W) Cannot pass an argument of non-POD class type "boost::re_detail::string_out_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >" through ellipsis.

Change History (1)

comment:1 by John Maddock, 11 years ago

Resolution: fixed
Status: newclosed

(In [74897]) Improve sprintf usage. Stop passing UDT's through (...) even in meta programs. Fixes #5958. Refs #5835.

Note: See TracTickets for help on using tickets.