Modify

Ticket #5958 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Reported by: "LeJacq, Jean Pierre" <jeanpierre.lejacq@…> Owned by: johnmaddock
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.

Attachments

Change History

comment:1 Changed 3 years ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to fixed

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.