[cfe-dev] an odd bug in CommonOptionsParser
VinsonL
lwhvinson1990 at gmail.com
Sat Mar 22 05:21:17 PDT 2014
I am a new learner in Clang and meet an odd bug.
My code is a simple case:
===================================================
.....
static llvm::cl::OptionCategory MyToolCategory("");
.....
int main(int argc, const char **argv)
{
CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
tooling::MyFactory Factory;
Tool.run(newFrontendActionFactory(&Factory));
return 0;
}
==================================================
but it report an very odd error when compile with clang++(my llvm&clang's
version is 3.4):
==================================================
ToolingTutorial.cpp:74:23: error: no matching constructor for initialization
of 'clang::tooling::CommonOptionsParser'
CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/acsa-amd2/Documents/llvm-3.4/tools/clang/include/clang/Tooling/CommonOptionsParser.h:67:3:
note: candidate constructor not
viable: no known conversion from 'llvm::cl::OptionCategory' to 'const
char *' for 3rd argument
CommonOptionsParser(int &argc, const char **argv, const char *Overview =
0);
^
/home/acsa-amd2/Documents/llvm-3.4/tools/clang/include/clang/Tooling/CommonOptionsParser.h:61:7:
note: candidate constructor
(the implicit move constructor) not viable: requires 1 argument, but 3
were provided
class CommonOptionsParser {
^
/home/acsa-amd2/Documents/llvm-3.4/tools/clang/include/clang/Tooling/CommonOptionsParser.h:61:7:
note: candidate constructor
(the implicit copy constructor) not viable: requires 1 argument, but 3
were provided
1 error generated.
make: *** [ToolingTutorial.o] Error 1
==================================================
it makes no sense that the constructor is no match and the compiler mistake
'llvm::cl::OptionCategory' for 'const char *' .
--
View this message in context: http://clang-developers.42468.n3.nabble.com/an-odd-bug-in-CommonOptionsParser-tp4038552.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev
mailing list