You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As fail_fast and narrowing_error are deriving from std::logic_error and from std::exception respectively, they both have a vtable. In a header-only library there is no compilation unit, which implies the vtables are emitted in every client compilation unit, putting burden to the linker to understand this is not a duplicate definition. That is what the warning is about.
Solution
Disable the warning locally.
Alternatives:
introduce a compilation unit (NO because: header-only is wanted)
…wirew0rm)
* Enable "-Wweak-vtables" warning for Clang and "-Wuseless-cast" for GCC
* Suppress these warnings inside gsl-lite.hpp for Clang and GCC
* Sneak in some drive-by comment updates
Fixes#322 and #325.
As
fail_fast
andnarrowing_error
are deriving fromstd::logic_error
and fromstd::exception
respectively, they both have a vtable. In a header-only library there is no compilation unit, which implies the vtables are emitted in every client compilation unit, putting burden to the linker to understand this is not a duplicate definition. That is what the warning is about.Solution
Alternatives:
template<typename = void> fail_fast ...
andthrow fail_fast<>
(NO because: Introduces complexity to hide a warning is never a good idea.)References:
-Wweak-vtables
on)gsl-lite
headerThe text was updated successfully, but these errors were encountered: