Compiling Attributes.cpp ... ../../../Attributes.cpp: In member function 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> > llvm::AttributeSet::getAllocSizeArgs() const': ../../../Attributes.cpp:542:69: error: operands to ?: have different types 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> >' and 'std::__1::pair<int, int>' return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0); ^ ../../../Attributes.cpp:543:1: error: control reaches end of non-void function [-Werror=return-type] } ^
Details
Details
Diff Detail
Diff Detail
Event Timeline
lib/IR/Attributes.cpp | ||
---|---|---|
542 | Could you just add u suffixes to the 0s instead? |
lib/IR/Attributes.cpp | ||
---|---|---|
542 | I could make it std::make_pair(0U, Optional<unsigned>(0)). If that is preferred? |
Comment Actions
Which platform exhibits this error? Also, it's an error, not a warning. The -Wreturn-type warning is a follow-on warning caused by the error in the return statement. Is this a problem with current or past versions libc++?
FWIW, I lifted this make_pair usage from elsewhere, hoping it would be portable:
std::pair<unsigned, Optional<unsigned>> AttributeSetNode::getAllocSizeArgs() const { // ... return std::make_pair(0, 0); }
lib/IR/Attributes.cpp | ||
---|---|---|
542 | That or std::pair<unsigned, Optional<unsigned>>(0, 0). We don't need make_pair if it can't deduce the types. |
Could you just add u suffixes to the 0s instead?