Closed samhocevar closed 9 years ago
Please report a bug against Visual C++ if you haven't done so already.
As a work-around, please try to include <type_traits>
and use
typename std::enable_if< sizeof( Rule::template match< E, Action, Control >( in, st ... ) ) != 0, bool >::type
as the first trailing return type and
typename std::enable_if< sizeof( Rule::match( in ) ) != 0, bool >::type
for the second. If that helps, I'd be willing to change the code to this uncool version :)
If it doesn't help, I can't do much as I don't have Visual C++. Of course, if you can come up with some other reasonable work-around, we'll look into it.
I have created a minimal test case and posted a bug report to Microsoft. I only have limited access to a Windows computer so I haven’t yet found a workaround. I will try your suggestion though, but I seem to remember trying something like that and it didn’t work because of sizeof
actually returning a fatal error.
Note by the way that if you have access to Windows, the Visual Studio technology previews can be downloaded freely.
I don't have Windows, so the free download of Visual Studio won't help me.
For now, I'm closing this issue as the bug is in the compiler of VS, not in our code. If you can come up with a viable work-around, please don't hesitate to let us know about it.
Sam,
can you please try to add a defaulted dummy template parameter to the second overload? Like this:
template< typename Input, typename ... States, int = 0 >
static auto match( Input & in, States && ... ) -> decltype( Rule::match( in ), bool() )
...
(but note: Just for the second overload!)
Thanks in advance!
Ah that’s clever! It did the trick, thanks.
Work-around committed.
The VS2015 technology preview is the only version that almost manages to build PEGTL. However, it fails to understand the decltype+comma SFINAE trick in
rule_match_call.hh
:Even though this is a compiler bug, do you think a workaround is possible? I have tried a few things but failed to come up with something that works.