Bug 2223035 - boost::numeric::ublas::vector list initializer not working
Summary: boost::numeric::ublas::vector list initializer not working
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: boost1.78
Version: 38
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Denis Arnaud
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-14 21:56 UTC by Brad Bell
Modified: 2023-07-14 21:56 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.