http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49021

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-17 
17:28:44 UTC ---
slightly more reduced

#include <boost/foreach.hpp>

struct vector
{
    typedef int* const* const_iterator;

    ~vector() { data = 0; }

    int* data;

    const_iterator begin() const { return &data; }
    const_iterator end() const { return &data + 1; }
};

int v = 1;

const vector
getv()
{
    vector ret = { &v };
    return ret;
}

int
main(int argc, char **argv)
{
    BOOST_FOREACH(int *w, getv())
        __builtin_printf("%d\n", *w);

    return 0;
}

Reply via email to