Boost logo

Boost :

From: Emre Turkay (emreturkay_at_[hidden])
Date: 2007-11-12 07:39:45


Hi folks,

I'm compiling a simple test application for boost::multi_index extractor
operator and getting the warning below. Count as a bug report.

OS: Ubuntu linux 7.10
Compiler: g++ (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
Compile flags: Shown below.

Thanks,

Emre Turkay

This is the code:

#include <iostream>
#include <iterator>

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/member.hpp>

struct Item
{
    Item() { }
    explicit Item(int val): value(val) { }

    int value;
};

std::istream& operator>>(std::istream& is, Item& p)
{
    return is >> p.value;
}

int main()
{
    typedef boost::multi_index::multi_index_container<
        Item,
        boost::multi_index::indexed_by<
            boost::multi_index::ordered_unique<
                boost::multi_index::member<Item,
                                           int,
                                           &Item::value
> > > > projects_map;

    projects_map projects;

    std::copy(std::istream_iterator<Item>(std::cin),
              std::istream_iterator<Item>(),
              std::inserter(projects, projects.begin()));
}

The compile command and the generated warning:

g++ -W -Wall -O2 -c -o main.o main.cpp
/usr/include/boost/multi_index/ordered_index.hpp: In function 'int main()':
/usr/include/boost/multi_index/ordered_index.hpp:566: warning: '
inf.boost::multi_index::detail::ordered_index<boost::multi_index::member<Item,
int, &Item::value>, std::less<int>, boost::multi_index::detail::nth_layer<1,
Item,
boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::member<Item,
int, &Item::value>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na>, std::allocator<Item> >, boost::mpl::vector0<mpl_::na>,
boost::multi_index::detail::ordered_unique_tag>::link_info::side' may be
used uninitialized in this function
g++ main.o -o test


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk