result icon indicating copy to clipboard operation
result copied to clipboard

Error compilling result.hpp on apple-clang.

Open tcanabrava opened this issue 3 years ago • 6 comments

Linux Compier: GCC 11 Mac Compiler: latest apple-clang

The resulting code works on linux / gcc, but on mac I get:

/result.hpp:3524:82: error: ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~' [-Werror,-Wdtor-name]
inline RESULT_INLINE_VISIBILITY RESULT_NS_IMPL::detail::result_union<T, E, false>::~result_union() noexcept(
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                                                 ::result_union

tcanabrava avatar May 05 '22 08:05 tcanabrava

https://stackoverflow.com/questions/68751682/is-a-class-templates-name-in-scope-for-a-qualified-out-of-line-destructors-def

tcanabrava avatar May 05 '22 08:05 tcanabrava

This change fixes for me:

RESULT_NS_IMPL::detail::result_union<T,E,false>
  ::~result_union()

should read:

RESULT_NS_IMPL::detail::result_union<T,E,false>
  ::~result_union<T,E,false>()

tcanabrava avatar May 05 '22 08:05 tcanabrava

Thanks for opening this issue.

Funny, the StackOverflow question you linked is actually my question that I asked, researched, and answered regarding this exact problem; I just forgot to follow-up on this. 😅

I'll make this change shortly.

bitwizeshift avatar Jun 19 '22 18:06 bitwizeshift

Also my apologies for missing this when it was opened; I apparently need to update my notification preferences.

bitwizeshift avatar Jun 19 '22 18:06 bitwizeshift

@tcanabrava Are you interested in making the PR for this? If not or if you don't respond in the following days, I'll be happy to do it.

tarcisiofischer avatar Aug 25 '22 11:08 tarcisiofischer

I also don't mind making this change since it's basically a 1-line fix. The only thing that stopped me was CI failures since it's been a long time since I've updated everything.

I prefer having the safety net of CI to tell me when changes aren't accepted for older compilers, since some of them are "quirky", in what they deem to be valid C++.

bitwizeshift avatar Aug 25 '22 12:08 bitwizeshift