0

I'm using QtTest and just updated to Qt 5.9 and have this kind of warnings:

error: use of the 'fallthrough' attribute is a C++1z extension [-Werror,-Wc++1z-extensions]

They all point to Q_FALLTHROUGH() in qtestmouse.h So obviously I need to add something to QMAKE_CXXFLAGS but can't find out what exactly.

I can ignore these warnings with pragma but want to understand this topic a little more.

htzfun
  • 1,231
  • 10
  • 41

1 Answers1

1

This is easy -- the answer is in the error message, where it says:

[-Werror,-Wc++1z-extensions]

That specifies which warning flags generated this diagnostic. In our case, we ignore the -Werror part as we don't want to turn that whole behavior off, but we can turn the warning off by using the no- form of the other flag, namely -Wno-c++1z-extensions.

(Q_FALLTHROUGH() is expanding to the C++17 [[fallthrough]] construct in your case due to the compiler and version you have supporting it.)

LThode
  • 1,843
  • 1
  • 17
  • 28