Skip to content

TRY macro does not work with Result<void, E> #6

@vorot93

Description

@vorot93

TRY macro fails when we have void associated with Ok (and rightfully so, since assigning void makes no sense).

Perhaps a separate macro for simple error propagation and static_assert for more informative failure?

in expansion of macro 'TRY'

result.h:631:14: note: candidate: template<class U> const U& details::Storage<void, E>::get() const [with U = U; E = int]
     const U& get() const {
              ^~~
result.h:631:14: note:   template argument deduction/substitution failed:
result.h: In substitution of 'template<class U> const U& details::Storage<void, E>::get() const [with U = void]':
result.h:631:14: error: forming reference to void
result.h:636:8: note: candidate: template<class U> U& details::Storage<void, E>::get() [with U = U; E = int]
     U& get() {
        ^~~
result.h:636:8: note:   template argument deduction/substitution failed:
result.h: In substitution of 'template<class U> U& details::Storage<void, E>::get() [with U = void]':
result.h:636:8: error: forming reference to void

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions