cantFail overloads

Synopses

Declared in <llvm/Support/Error.h>

Report a fatal error if Err is a failure value.

void
cantFail(
    Error Err,
    char const* Msg = nullptr);

Report a fatal error if ValOrErr is a failure value, otherwise unwraps and returns the contained value.

template<typename T>
T
cantFail(
    Expected<T> ValOrErr,
    char const* Msg = nullptr);

Report a fatal error if ValOrErr is a failure value, otherwise unwraps and returns the contained reference.

template<typename T>
T&
cantFail(
    Expected<T&> ValOrErr,
    char const* Msg = nullptr);

Return Value

  • The contained value from ValOrErr.

  • The contained reference from ValOrErr.

Parameters

Name

Description

Err

Error that must represent success.

Msg

Optional message used if Err is a failure.

ValOrErr

Expected value that must hold success.

Created with MrDocs