Boost C++ Libraries: Ticket #10440: boyer_moore.hpp fails on Linux w/ gcc-4.7.2, OK with Mac clang https://svn.boost.org/trac10/ticket/10440 <p> I have a simple find-string-in-file program that uses boyer_moore matching. On Mac, it compiles and works OK. (Not sure if Mac is really using gcc; that's the command name, but "gcc -v" says "Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)" </p> <p> At any rate, the same code, with a freshly-compiled Boost-1.56.0 on Debian 7, gcc-4.7.2, fails to compile: </p> <pre class="wiki">g++ -g -I. -I/usr/local/include -c -o find.o find.cc In file included from /usr/local/include/boost/range/iterator.hpp:24:0, from /usr/local/include/boost/range/begin.hpp:24, from /usr/local/include/boost/algorithm/searching/boyer_moore.hpp:18, from find.cc:5: /usr/local/include/boost/mpl/eval_if.hpp: In instantiation of ‘struct boost::mpl::eval_if_c&lt;false, boost::range_const_iterator&lt;const unsigned char*, void&gt;, boost::range_mutable_iterator&lt;const unsigned char*, void&gt; &gt;’: /usr/local/include/boost/range/iterator.hpp:69:17: required from ‘struct boost::range_iterator&lt;const unsigned char*, void&gt;’ /usr/local/include/boost/algorithm/searching/boyer_moore.hpp:243:5: required by substitution of ‘template&lt;class PatternRange, class CorpusRange&gt; typename boost::range_iterator&lt;CorpusRange&gt;::type boost::algorithm::boyer_moore_search(CorpusRange&amp;, const PatternRange&amp;) [with PatternRange = const unsigned char*; CorpusRange = const unsigned char*]’ find.cc:26:106: required from here /usr/local/include/boost/mpl/eval_if.hpp:60:31: error: no type named ‘type’ in ‘boost::mpl::eval_if_c&lt;false, boost::range_const_iterator&lt;const unsigned char*, void&gt;, boost::range_mutable_iterator&lt;const unsigned char*, void&gt; &gt;::f_ {aka struct boost::range_mutable_iterator&lt;const unsigned char*, void&gt;}’ make: *** [find.o] Error 1 </pre><p> (On Mac also, I compiled a fresh copy of Boost-1.56.0 using the native compiler.) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10440 Trac 1.4.3 Marshall Clow Tue, 02 Sep 2014 03:59:09 GMT <link>https://svn.boost.org/trac10/ticket/10440#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10440#comment:1</guid> <description> <blockquote class="citation"> <p> (Not sure if Mac is really using gcc; that's the command name, but "gcc -v" says "Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)" </p> </blockquote> <p> Yeah, on Mac OS starting with 10.9 (I think), <code>gcc</code> is just an alias to <code>clang</code>. </p> <p> Do you have a small case that fails? </p> <p> Looking at the test results, the tests for boyer-moore seem to be passing on most of the linux testers, though non of them are using 4.7.2 (some are using newer versions, some are older). </p> </description> <category>Ticket</category> </item> <item> <author>boost@…</author> <pubDate>Tue, 02 Sep 2014 04:28:39 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/10440 https://svn.boost.org/trac10/ticket/10440 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bmtest.cc</span> </li> </ul> <p> Small test case that fails to compile on Linux w/ g++-4.7.2 </p> Ticket boost@… Tue, 02 Sep 2014 04:30:45 GMT <link>https://svn.boost.org/trac10/ticket/10440#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10440#comment:2</guid> <description> <p> That program compiles &amp; runs on Mac w/ clang, but not on Linux: </p> <pre class="wiki">user@aluminum-debian:/var/tmp$ g++ -v bmtest.cc Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-5) COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE bmtest.cc -quiet -dumpbase bmtest.cc -mtune=generic -march=x86-64 -auxbase bmtest -version -o /tmp/ccrt5zzG.s GNU C++ (Debian 4.7.2-5) version 4.7.2 (x86_64-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include &lt;...&gt; search starts here: /usr/include/c++/4.7 /usr/include/c++/4.7/x86_64-linux-gnu /usr/include/c++/4.7/backward /usr/lib/gcc/x86_64-linux-gnu/4.7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. GNU C++ (Debian 4.7.2-5) version 4.7.2 (x86_64-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 66d178dd81da8c975e003e06d9f5e782 In file included from /usr/local/include/boost/range/iterator.hpp:24:0, from /usr/local/include/boost/range/begin.hpp:24, from /usr/local/include/boost/algorithm/searching/boyer_moore.hpp:18, from bmtest.cc:2: /usr/local/include/boost/mpl/eval_if.hpp: In instantiation of ‘struct boost::mpl::eval_if_c&lt;false, boost::range_const_iterator&lt;const char*, void&gt;, boost::range_mutable_iterator&lt;const char*, void&gt; &gt;’: /usr/local/include/boost/range/iterator.hpp:69:17: required from ‘struct boost::range_iterator&lt;const char*, void&gt;’ /usr/local/include/boost/algorithm/searching/boyer_moore.hpp:243:5: required by substitution of ‘template&lt;class PatternRange, class CorpusRange&gt; typename boost::range_iterator&lt;CorpusRange&gt;::type boost::algorithm::boyer_moore_search(CorpusRange&amp;, const PatternRange&amp;) [with PatternRange = const char*; CorpusRange = const char*]’ bmtest.cc:12:63: required from here /usr/local/include/boost/mpl/eval_if.hpp:60:31: error: no type named ‘type’ in ‘boost::mpl::eval_if_c&lt;false, boost::range_const_iterator&lt;const char*, void&gt;, boost::range_mutable_iterator&lt;const char*, void&gt; &gt;::f_ {aka struct boost::range_mutable_iterator&lt;const char*, void&gt;}’ </pre> </description> <category>Ticket</category> </item> <item> <author>boost@…</author> <pubDate>Tue, 02 Sep 2014 04:34:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10440#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10440#comment:3</guid> <description> <p> FWIW, it looks like the section of eval_if where the error occurs already has some BOOST_WORKAROUND hackery going on. Maybe it just needs to know about quirks in gcc-4.7.2? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 02 Sep 2014 13:47:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10440#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10440#comment:4</guid> <description> <p> I don't have 4.7.x laying around, but I was able to replicate this with 4.8.1 and 4.9.1 (both on Mac OS X) </p> <p> It appears that gcc is trying to instantiate the two argument version of <code>boyer_moore_search</code>(line 243), which is failing, and then rather than dropping that from the overload set, it is generating an error. </p> <p> If I comment out the range based-version (aka the two argument one), then your test compiles and runs. </p> </description> <category>Ticket</category> </item> <item> <author>boost@…</author> <pubDate>Tue, 02 Sep 2014 14:07:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10440#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10440#comment:5</guid> <description> <p> Thanks, that helps! (I was compiling 4.9.1 just now...figured I'd give it a try! But I'd rather not wander off into gcc-version-incompatibility hell.) </p> <p> I commented out the same section of boyer_moore.hpp (lines 240-249) and also had success. </p> <p> Thanks very much! </p> </description> <category>Ticket</category> </item> </channel> </rss>