Opened 9 years ago

Closed 4 years ago

#8896 closed Bugs (fixed)

image_view compile error under clang 3.1

Reported by: Shaun Marko <shaunm@…> Owned by: Stefan Seefeld
Milestone: Boost 1.69 Component: gil USE GITHUB
Version: Boost 1.54.0 Severity: Problem
Keywords: image_view clang Cc: smarko@…, mateusz@…

Description

The definition of template <std::size_t D> typename axis<D>::iterator image_view::axis_iterator(const point& p) (image_view.hpp, line 139) confuses clang++ 3.8. The following program fails to compile.

Example program

#include <iostream>
#include <boost/gil/gil_all.hpp>

using namespace boost;
using namespace gil;

int main(int argc, char **argv)
{
    gray8_image_t img(2,2);
    gray8_view_t vw(view(img));
    gray8_view_t::point_t p(0,0);
    gray8_view_t::axis<0>::iterator iter = vw.axis_iterator<0>(p);
    std::cout << (*iter)[0] << std::endl;
    return 0;
}

clang++ error:

clang++  -Wall -I/usr/local/include/ -c img.cpp
In file included from img.cpp:2:
In file included from /usr/local/include/boost/gil/gil_all.hpp:27:
In file included from /usr/local/include/boost/gil/algorithm.hpp:27:
/usr/local/include/boost/gil/image_view.hpp:139:104: error: reference to non-static member function must be called
    template <std::size_t D> typename axis<D>::iterator axis_iterator(const point_t& p) const { return _pixels.axis_iterator<D>(p); }
                                                                                                       ^~~~~~~~~~~~~~~~~~~~~
img.cpp:12:47: note: in instantiation of function template specialization 'boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mpl::vector1<boost::gil::gray_color_t>, boost::mpl::range_c<int, 0, 1> > > *> > >::axis_iterator<0>' requested here
    gray8_view_t::axis<0>::iterator iter = vw.axis_iterator<0>(p);
                                              ^
In file included from img.cpp:2:
In file included from /usr/local/include/boost/gil/gil_all.hpp:27:
In file included from /usr/local/include/boost/gil/algorithm.hpp:27:
/usr/local/include/boost/gil/image_view.hpp:139:125: error: invalid operands to binary expression ('<bound member function type>' and 'unsigned long')
    template <std::size_t D> typename axis<D>::iterator axis_iterator(const point_t& p) const { return _pixels.axis_iterator<D>(p); }
                                                                                                       ~~~~~~~~~~~~~~~~~~~~~^~
2 errors generated.
*** [img.o] Error code 1

A patch is attached which works against clang 3.8 and gcc 4.2.1.

Attachments (1)

patch.txt (813 bytes ) - added by Shaun Marko <shaunm@…> 9 years ago.
image_view.hpp patch

Download all attachments as: .zip

Change History (9)

by Shaun Marko <shaunm@…>, 9 years ago

Attachment: patch.txt added

image_view.hpp patch

comment:1 by Shaun Marko <shaunm@…>, 9 years ago

Summary: image_view compile error under clang++ 3.8image_view compile error under clang 3.1

Correction: clang 3.1

comment:2 by Shaun Marko <smarko@…>, 9 years ago

Cc: smarko@… added

comment:3 by viboes, 9 years ago

Component: NoneGIL
Owner: set to Hailin Jin

comment:4 by Mateusz Loskot, 6 years ago

Cc: mateusz@… added

comment:5 by Stefan Seefeld, 5 years ago

Owner: changed from Hailin Jin to Stefan Seefeld

comment:6 by Mateusz Loskot, 4 years ago

Fixed by pending pull request https://github.com/boostorg/gil/pull/129

comment:7 by Mateusz Loskot, 4 years ago

Milestone: To Be DeterminedBoost 1.69

comment:8 by Mateusz Loskot, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.