http://llvm.org/bugs/show_bug.cgi?id=3900
Summary: Support/CommandLine.h: Implicit conversion from external
storage fails to compile
Product: new-bugs
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
$ cat test.cpp
#include "llvm/Support/CommandLine.h"
using namespace llvm;
int storage;
static cl::opt<int, true> optimizeLevel("O",
cl::desc("Optimization level"),
cl::location(storage));
int getOptLevel() {
return optimizeLevel;
}
$ g++ test.cpp `llvm-config --cxxflags` -c
/home/urxae/opt/llvm/include/llvm/Support/CommandLine.h: In member function
âconst DataType& llvm::cl::opt_storage<DataType, ExternalStorage,
isClass>::getValue() const [with DataType = int, bool ExternalStorage = true,
bool isClass = false]â:
/home/urxae/opt/llvm/include/llvm/Support/CommandLine.h:864: instantiated
from âllvm::cl::opt<DataType, ExternalStorage, ParserClass>::operator
DataType() const [with DataType = int, bool ExternalStorage = true, ParserClass
= llvm::cl::parser<int>]â
test.cpp:12: instantiated from here
/home/urxae/opt/llvm/include/llvm/Support/CommandLine.h:779: error: passing
âconst llvm::cl::opt_storage<int, true, false>â as âthisâ argument of
âvoid llvm::cl::opt_storage<DataType, ExternalStorage, isClass>::check()
[with DataType = int, bool ExternalStorage = true, bool isClass = false]â
discards qualifiers
The obvious fix is to make opt_storage::check() const since it doesn't modify
anything.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs