taocpp / PEGTL

Parsing Expression Grammar Template Library
Boost Software License 1.0
1.94k stars 228 forks source link

compile issue on OSX #1

Closed jkhoogland closed 9 years ago

jkhoogland commented 9 years ago

Hi, I pulled down the code, and tried to build on OS X 10.9.5. It failed though as shown below, I didn't have time to look at it more, but i thought might be useful to know, Regards Jiri

System details:

[2015.01.19:11.11][Jiri@jirimbp:~/lib/cpp/PEGTL]$  g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

It fails with the following message:

c++ -I. -std=c++11 -pedantic -Wall -Wextra -Werror -O3 source/modulus_match.cc -o build/source/modulus_match
In file included from source/modulus_match.cc:4:
In file included from ./pegtl.hh:8:
In file included from ./pegtl/parse.hh:14:
In file included from ./pegtl/internal/rule_match_help.hh:11:
In file included from ./pegtl/internal/rule_match_impl.hh:10:
./pegtl/internal/rule_match_call.hh:17:88: error: 'match' following the 'template' keyword does not
      refer to a template
  ...auto match( Input & in, States && ... st ) -> decltype( Rule::template match< E, Action, Con...
                                                             ~~~~~~         ^
./pegtl/internal/rule_match_impl.hh:43:18: note: in instantiation of template class
      'pegtl::internal::rule_match_call<modulus::my_rule<3, 0>, 1, nothing, normal>' requested here
            if ( rule_match_call< Rule, error_mode::THROW, Action, Control >::match( in, st ...
                 ^
./pegtl/internal/rule_match_help.hh:20:173: note: in instantiation of function template
      specialization 'pegtl::internal::rule_match_impl<modulus::my_rule<3, 0>, 1, nothing, normal,
      1>::match<pegtl::input>' requested here
  ...Action< Rule > >::value ? apply_here::NOTHING : apply_here::ACTION >::template match( in, s...
                                                                                    ^
./pegtl/internal/rule_conjunction_impl.hh:31:20: note: in instantiation of function template
      specialization 'pegtl::internal::rule_match_help<modulus::my_rule<3, 0>, 1, nothing, normal,
      pegtl::input>' requested here
            return rule_match_help< Rule, E, Action, Control >( in, st ... ) && rule_conjunc...
                   ^
./pegtl/internal/until.hh:47:88: note: in instantiation of function template specialization
      'pegtl::internal::rule_conjunction_impl<modulus::my_rule<3, 0> >::match<1, nothing, normal,
      pegtl::input>' requested here
  ...if ( in.empty() || ! rule_conjunction_impl< Rule, Rules ... >::template match< E, Action, Co...
                                                                             ^
./pegtl/internal/rule_match_call.hh:19:35: note: in instantiation of function template
      specialization 'pegtl::internal::until<pegtl::ascii::eolf, modulus::my_rule<3, 0> >::match<1,
      nothing, normal, pegtl::input>' requested here
            return Rule::template match< E, Action, Control >( in, st ... );
                                  ^
./pegtl/internal/rule_match_impl.hh:43:79: note: in instantiation of function template
      specialization 'pegtl::internal::rule_match_call<modulus::grammar, 1, nothing,
      normal>::match<pegtl::input>' requested here
            if ( rule_match_call< Rule, error_mode::THROW, Action, Control >::match( in, st ...
                                                                              ^
./pegtl/internal/rule_match_help.hh:20:173: note: in instantiation of function template
      specialization 'pegtl::internal::rule_match_impl<modulus::grammar, 1, nothing, normal,
      1>::match<pegtl::input>' requested here
  ...Action< Rule > >::value ? apply_here::NOTHING : apply_here::ACTION >::template match( in, s...
                                                                                    ^
./pegtl/parse.hh:21:17: note: in instantiation of function template specialization
      'pegtl::internal::rule_match_help<modulus::grammar, 1, nothing, normal, pegtl::input>'
      requested here
      internal::rule_match_help< Rule, error_mode::THROW, Action, Control >( in, st ... );
                ^
./pegtl/parse.hh:28:7: note: in instantiation of function template specialization
      'pegtl::parse<modulus::grammar, nothing, normal>' requested here
      parse< Rule, Action, Control >( in, st ... );
      ^
source/modulus_match.cc:33:14: note: in instantiation of function template specialization
      'pegtl::parse<modulus::grammar, nothing, normal>' requested here
      pegtl::parse< modulus::grammar >( 1, argv );
             ^
1 error generated.
make: *** [build/source/modulus_match] Error 1
d-frey commented 9 years ago

The problem is IMHO a bug in Clang. The error shows up despite the fact that SFINAE disables the candidate. I was able to reproduce the problem with Clang 3.4 on Ubuntu, but I was unable to reproduce the problem with Clang 3.5.

Anyways, I committed a fix which should solve it. It basically means that for those versions of Clang that are affected by the bug, the match-method must be a template.