boost::optional を使っている gnash::DragState の hasBounds でビルドエラー出てる
こーいうエラーが出てビルドできない:
Making all in vm
make[4]: ディレクトリ '/home/rihine/opt/src/gnash/libcore/vm' に入ります
CXX ASHandlers.lo
In file included from ASHandlers.cpp:46:0:
../../libcore/DragState.h: In member function 'bool gnash::DragState::hasBounds() const':
../../libcore/DragState.h:65:24: error: cannot convert 'const boost::optional<gnash::SWFRect>' to 'bool' in return
return (_bounds);
^
Makefile:757: ターゲット 'ASHandlers.lo' のレシピで失敗しました
ので:
// test_dragstate.cpp #include <boost/cstdint.hpp> #include <boost/optional.hpp> class SWFRect { // private: // std::int32_t _top; // std::int32_t _left; // std::int32_t _bottom; // std::int32_t _right; }; class DragState { public: bool hasBounds() const { return (_bounds); } const SWFRect& getBounds() const { return *_bounds; } void setBounds(const SWFRect& bounds) { _bounds = bounds; } private: boost::optional<SWFRect> _bounds; }; int main() { }
こーいうテストコードをこんな makefile で:
CXX = g++ DEFINES = INCLUDES = CXOTHERS = CXFLAGS = -W -Wall -O2 $(DEFINES) $(CXOTHERS) $(INCLUDES) LD = g++ LDFLAGS = src0 = test_dragstate.cpp obj0 = test_dragstate.o objs = $(obj0) target = test_dragstate all: $(target) build: all rebuild: clean build $(target): $(objs) $(LD) $(LDFLAGS) $^ -o $@ .cpp.o: $(CXX) $(CXFLAGS) -c $< -o $@ clean: @rm $(target) $(objs)
ビルドしてみると:
% make
g++ -W -Wall -O2 -c test_dragstate.cpp -o test_dragstate.o
g++ test_dragstate.o -o test_dragstate
ビルドでけた。
何がおかしいのかよく分からない。