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

Reply via email to