Define ErrorInfo::ID explicitly.

llvm-svn: 264293
This commit is contained in:
NAKAMURA Takumi 2016-03-24 15:26:43 +00:00
parent e1c42ac12b
commit e6d29c9928
3 changed files with 7 additions and 3 deletions

View File

@ -291,9 +291,6 @@ private:
static char ID;
};
template <typename MyErrT, typename ParentErrT>
char ErrorInfo<MyErrT, ParentErrT>::ID = 0;
/// Special ErrorInfo subclass representing a list of ErrorInfos.
/// Instances of this class are constructed by joinError.
class ErrorList final : public ErrorInfo<ErrorList> {

View File

@ -37,6 +37,9 @@ namespace {
void ErrorInfoBase::anchor() {}
char ErrorInfoBase::ID = 0;
template <> char ErrorInfo<ErrorList>::ID = 0;
template <> char ErrorInfo<ECError>::ID = 0;
static ManagedStatic<ErrorErrorCategory> ErrorErrorCat;
std::error_code ErrorList::convertToErrorCode() const {

View File

@ -45,6 +45,8 @@ protected:
int Info;
};
template <> char ErrorInfo<CustomError>::ID = 0;
// Custom error class with a custom base class and some additional random
// 'info'.
class CustomSubError : public ErrorInfo<CustomSubError, CustomError> {
@ -70,6 +72,8 @@ protected:
int ExtraInfo;
};
template <> char ErrorInfo<CustomSubError, CustomError>::ID = 0;
static Error handleCustomError(const CustomError &CE) { return Error(); }
static void handleCustomErrorVoid(const CustomError &CE) {}