Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error on using constexpr in qt 6.5
Forum Updated to NodeBB v4.3 + New Features

Error on using constexpr in qt 6.5

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 600 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QtsCOde
    wrote on last edited by
    #1

    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.

    sierdzioS 1 Reply Last reply
    0
    • Q QtsCOde

      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.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @QtsCOde constexpr needs a constant, like 5 or 12 + 8. That pretty much rules out all functions like normalizeTypeFromSignature(). Just use const instead and it will should work.

      (Z(:^

      Q 1 Reply Last reply
      1
      • sierdzioS sierdzio

        @QtsCOde constexpr needs a constant, like 5 or 12 + 8. That pretty much rules out all functions like normalizeTypeFromSignature(). Just use const instead and it will should work.

        Q Offline
        Q Offline
        QtsCOde
        wrote on last edited by
        #3

        @sierdzio But this is defined in the qt pre-defined file qmetatype.h.
        Should I be making changes in this file?

        sierdzioS 1 Reply Last reply
        0
        • Q QtsCOde

          @sierdzio But this is defined in the qt pre-defined file qmetatype.h.
          Should I be making changes in this file?

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @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.

          (Z(:^

          Q 1 Reply Last reply
          0
          • sierdzioS sierdzio

            @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.

            Q Offline
            Q Offline
            QtsCOde
            wrote on last edited by
            #5

            @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.

            sierdzioS 1 Reply Last reply
            0
            • Q QtsCOde

              @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.

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              @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.

              (Z(:^

              sierdzioS Q 2 Replies Last reply
              1
              • sierdzioS sierdzio

                @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.

                sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                I think you can also check Qt bug tracker and maybe report this. Looks like it should not be happening.

                (Z(:^

                kkoehneK 1 Reply Last reply
                0
                • sierdzioS sierdzio

                  @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.

                  Q Offline
                  Q Offline
                  QtsCOde
                  wrote on last edited by
                  #8

                  @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.

                  Q 1 Reply Last reply
                  0
                  • sierdzioS sierdzio

                    I think you can also check Qt bug tracker and maybe report this. Looks like it should not be happening.

                    kkoehneK Offline
                    kkoehneK Offline
                    kkoehne
                    Moderators
                    wrote on last edited by
                    #9

                    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"

                    Director R&D, The Qt Company

                    Q 1 Reply Last reply
                    2
                    • kkoehneK kkoehne

                      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"

                      Q Offline
                      Q Offline
                      QtsCOde
                      wrote on last edited by
                      #10

                      @kkoehne Yes I guess there is some mistake from my side(obviously). I will run a smaller project and see if it works or not, and try to reproduce the same issue. Thank you for the help.

                      1 Reply Last reply
                      0
                      • Q QtsCOde

                        @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.

                        Q Offline
                        Q Offline
                        QtsCOde
                        wrote on last edited by
                        #11

                        @QtsCOde f1adbb0f-85d1-4a6b-a353-bc108c23d9e4-image.png
                        These are the options

                        sierdzioS 1 Reply Last reply
                        0
                        • Q QtsCOde

                          @QtsCOde f1adbb0f-85d1-4a6b-a353-bc108c23d9e4-image.png
                          These are the options

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          @QtsCOde It's probably because of Intel compiler, then.

                          (Z(:^

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved