Error on using constexpr in qt 6.5
-
Is this expression correct in qt version 6.5?
constexpr int len = QTypeNormalizer{ nullptr }.normalizeTypeFromSignature(begin, end);
I am getting this error:"expression must have a constant value" when building in qt 6.5.
-
@QtsCOde
constexpr
needs a constant, like5
or12 + 8
. That pretty much rules out all functions likenormalizeTypeFromSignature()
. Just useconst
instead and it will should work. -
@sierdzio But this is defined in the qt pre-defined file qmetatype.h.
Should I be making changes in this file? -
@QtsCOde oh, I see. So you are getting this error when you do what? Compile your application or compile Qt itself?
Either way it looks like a possible bug in Qt, features are probably not detected correctly for your compiler.
-
@sierdzio I am trying to build my project in visual studio. Actually my project used to run in qt 5.9 but I upgraded to qt version 6.5 and so I am getting this and some other errors.
-
@QtsCOde Qt 6.5 deprecates a lot of stuff and has some big changes (especially in QML). Maybe first try with 6.4 and if that works it will be easier to migrate to 6.5.
I think you can also check Qt bug tracker and maybe report this. Looks like it should not be happening.
-
@QtsCOde Qt 6.5 deprecates a lot of stuff and has some big changes (especially in QML). Maybe first try with 6.4 and if that works it will be easier to migrate to 6.5.
-
I think you can also check Qt bug tracker and maybe report this. Looks like it should not be happening.
I think the code itself is correct, as normalizeTypeFromSignature() is itself marked with constexpr. It's also not new code (first released Qt 6.0), and there are no related bugs about it, so I think you're doing something 'special'.
Which MSVC version / compiler are you using? What compiler options are set?
Best would be if you could provide a minimal project that reproduces your issue, and file that on bugreports.qt.io, project "Qt", component "Build Systems"
-
I think the code itself is correct, as normalizeTypeFromSignature() is itself marked with constexpr. It's also not new code (first released Qt 6.0), and there are no related bugs about it, so I think you're doing something 'special'.
Which MSVC version / compiler are you using? What compiler options are set?
Best would be if you could provide a minimal project that reproduces your issue, and file that on bugreports.qt.io, project "Qt", component "Build Systems"
-
@sierdzio OKay then will try to run it maybe first on 5.15 first, actually its a pdf reader that uses pdf.js which I am trying to build.