I lately stumbled upon the bug #25104 while I wanted to create a custom parser for a cl::opt<float> command line option. Since cl::parser<T> implementations were marked final in 3.7, it is no longer possible to derive from them as described in the CommandLine documentation. Deriving from cl::basic_parser<T> for fundamental types is not possible either, causing a compile error like
llvm/include/llvm/Support/CommandLine.h:1109:20: No viable conversion from 'const (anonymous namespace)::CustomParser' to 'const parser<T>'
This small patch allows to derive from cl::basic_parser<T> for fundamental types. Please note that this patch does not allow to build upon existing parsers again (as prev. possible by inheriting from cl::parser<T>), i.e. custom parser for numeric options must reimplement number parsing. This is not ideal, I know, but I do not have an idea how to make this easily possible again without removing final from cl::parser<T>. Any ideas that can be incorporated in this patch are welcome of course :-)
I kindly ask for review.
~~~~~~~~~~
Chris
I'll remove these three lines in the next revision -- this slipped through code cleanup, sorry!