Bug 2223035

Summary: boost::numeric::ublas::vector list initializer not working
Product: [Fedora] Fedora Reporter: Brad Bell <bradbell>
Component: boost1.78Assignee: Denis Arnaud <denis.arnaud_fedora>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: denis.arnaud_fedora
Target Milestone: ---Keywords: Upgrades
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brad Bell 2023-07-14 21:56:19 UTC
This is related to the following boost bug:
https://github.com/boostorg/ublas/issues/63

Which was supposedly fixed by on Apr 12, 2020.
The version of boost on Fedora 38 is 1.78.0 which corresponds to Dec 1, 2021; see
https://github.com/boostorg/boost/releases/tag/boost-1.78.0

Reproducible: Always

Steps to Reproduce:
Store the script in Additional Information as boost_vector.sh and run it as follows:
  ./boost_vector.sh boost

Actual Results:  
boost>./boost_vector.sh boost
boost_vector.cpp: In function ‘int main()’:
boost_vector.cpp:5:57: error: narrowing conversion of ‘1.0e+0’ from ‘double’ to ‘boost::numeric::ublas::vector<double>::size_type’ {aka ‘long unsigned int’} [-Wnarrowing]
    5 | {  boost::numeric::ublas::vector<double> v = { 1.0, 2.0 };
      |                                                         ^
boost>


Expected Results:  
boost>./boost_vector.sh boost
boost_vector: OK
boost>


#! /usr/bin/env bash
set -u -e
if [ $# != 1 ]
then
   echo 'usage: ./boost_vector.sh (std|boost)'
   exit 1
fi
if [ "$1" == 'std' ]
then
   vector_type="std::vector<double>"
else
   vector_type="boost::numeric::ublas::vector<double>"
fi
cat << EOF > boost_vector.cpp
# include <vector>
# include <boost/numeric/ublas/vector.hpp>

int main(void)
{  $vector_type v = { 1.0, 2.0 };
   if( v.size() == 2 && v[0] == 1.0 && v[1] == 2.0 )
      return 0;
   return 1;
}
EOF
g++ boost_vector.cpp -o boost_vector
if ! ./boost_vector
then
   echo 'boost_vector: Error'
   exit 1
fi
#
echo 'boost_vector: OK'
exit 0