stubgen icon indicating copy to clipboard operation
stubgen copied to clipboard

Parse error on std::function template parameters

Open Archivist062 opened this issue 8 years ago • 1 comments

Parse error on :

typedef std::function<int()> IntGetter;
std::function<char(char)> converter;
int h(std::function<unsigned long(double)>);

and any std::function template parameter (seems like the '(' and ')' are not supported so no function pointer may actually work, not tested with C function pointers.

Archivist062 avatar May 05 '17 17:05 Archivist062

Thanks for the bug report!

stubgen's parser does not conform to the latest C++ standard. It was developed back in 1998 as a gigantic hack that I created when I was teaching myself lex/yacc. Hacking the yacc grammar further probably isn’t a good idea, since C++ isn’t an LALR(1) language anyways.

At the time it was written it handled C++98 pretty well - but it may not handle C++03 or C++11 well at all.

If you would be interested in adapting the grammar to handle this case, we would gladly accept a pull request.

mjradwin avatar May 07 '17 07:05 mjradwin