Modify

Opened 6 years ago

Closed 6 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: 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 (0)

Change History (1)

comment:1 Changed 6 years ago by johnmaddock

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

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain johnmaddock.
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.