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
Same issue as #48. When I define a W_OBJECT in an anonymous namespace, building using Clang (MSVC ABI) on Windows, I get the following kind of warning:
C:/Users/nyanpasu64/code/exotracker-cpp/src/gui/instrument_list.cpp:31:5: warning: unused variable 'W_UnscopedName' [-Wunused-const-variable]
W_OBJECT(InstrumentListModel)
^
C:/Users/nyanpasu64/code/exotracker-cpp/3rdparty\verdigris/wobjectdefs.h:771:5: note: expanded from macro 'W_OBJECT'
W_OBJECT_COMMON(TYPE) \
^
C:/Users/nyanpasu64/code/exotracker-cpp/3rdparty\verdigris/wobjectdefs.h:752:31: note: expanded from macro 'W_OBJECT_COMMON'
static constexpr auto W_UnscopedName = w_internal::viewLiteral(#TYPE); /* so we don't repeat it in W_CONSTRUCTOR */ \
^
staticconstexprauto W_UnscopedName = w_internal::viewLiteral(#TYPE); /* so we don't repeat it in W_CONSTRUCTOR */ \
This macro turns into a static member variable, declared in a QObject subclass's body, so you can't use Q_UNUSED (which is only valid in functions).
Solutions
[[maybe_unused]] static constexpr auto W_UnscopedName works in my testing, but unfortunately this is C++17-only and Verdigris supports C++14 as well.
Q_DECL_UNUSED static constexpr auto W_UnscopedName also works, but Q_DECL_UNUSED seems to be broken in some Clang configurations: https://bugreports.qt.io/browse/QTBUG-69424
The text was updated successfully, but these errors were encountered:
Same issue as #48. When I define a
W_OBJECT
in an anonymous namespace, building using Clang (MSVC ABI) on Windows, I get the following kind of warning:verdigris/src/wobjectdefs.h
Line 752 in fda6e91
This macro turns into a static member variable, declared in a QObject subclass's body, so you can't use
Q_UNUSED
(which is only valid in functions).Solutions
[[maybe_unused]] static constexpr auto W_UnscopedName
works in my testing, but unfortunately this is C++17-only and Verdigris supports C++14 as well.Q_DECL_UNUSED static constexpr auto W_UnscopedName
also works, butQ_DECL_UNUSED
seems to be broken in some Clang configurations: https://bugreports.qt.io/browse/QTBUG-69424The text was updated successfully, but these errors were encountered: