ricab / scope_guard

A modern C++ scope guard that is easy to use but hard to misuse.

Home Page:https://ricab.github.io/scope_guard/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong template parameter in destructor

ricab opened this issue · comments

Originally posted by @jasonivey in #17 (comment)

There are two errors/warnings which seem to conflict:

  • GCC 11 with C++20 enabled gives the error:
    scope_guard/scope_guard.hpp:152:36: error: template-id not allowed for destructor
      152 | sg::detail::scope_guard<Callback>::~scope_guard<Callback>() noexcept
            |                                    ^
    
  • Clang 12/13/14 triggers the warning -Wdtor-name:
    warning: ISO C++ requires the name after ‘::~’ to be found in the same scope as the name before ‘::~’
    
    Note: this was (incorrectly) fixed with pull request #10 right before the last release