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. Why is Q_DECL_NOEXCEPT macro empty using C++11?
Forum Update on Tuesday, May 27th 2025

Why is Q_DECL_NOEXCEPT macro empty using C++11?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.9k Views 2 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.
  • S Offline
    S Offline
    Suares
    wrote on 16 Jan 2017, 20:03 last edited by Suares
    #1

    I'm using Qt 5.7.1 clang 64. Clang version - Apple LLVM version 8.0.0 (clang-800.0.42.1)
    If I write Q_DECL_NOEXCEPT or Q_DECL_CONSTEXPR macros in my code and follow symbol under cursor (F2) I'm getting:

    # define Q_DECL_CONSTEXPR
    # define Q_DECL_NOEXCEPT
    

    I thought above macros must be:

    # define Q_DECL_CONSTEXPR constexpr
    # define Q_DECL_NOEXCEPT noexcept
    

    I put in .pro file such line:
    CONFIG += c++11
    actually it's by default there.

    Could you possibly tell me how I can fix that?

    UPD: And Q_NULLPTR is NULL instead of nullptr. Hmmm...

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Jan 2017, 23:20 last edited by
      #2

      Hi,

      Check whether Q_COMPILER_NOEXCEPT is defined.

      The compiler detection header is pretty complex so I wouldn't be surprised that you get shown the wrong line.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 17 Jan 2017, 20:51
      2
      • S SGaist
        16 Jan 2017, 23:20

        Hi,

        Check whether Q_COMPILER_NOEXCEPT is defined.

        The compiler detection header is pretty complex so I wouldn't be surprised that you get shown the wrong line.

        S Offline
        S Offline
        Suares
        wrote on 17 Jan 2017, 20:51 last edited by
        #3

        @SGaist

        Hi! No, it isn't defined in my case.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 17 Jan 2017, 21:01 last edited by
          #4

          How did you test that ?

          I just checked and its defined properly as it should.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply 17 Jan 2017, 21:12
          0
          • S SGaist
            17 Jan 2017, 21:01

            How did you test that ?

            I just checked and its defined properly as it should.

            S Offline
            S Offline
            Suares
            wrote on 17 Jan 2017, 21:12 last edited by Suares
            #5

            @SGaist

            Opened qcompilerdetection.h header file.

            alt text

            I was surprised to see that all C++11 features weren't detected. Hmmm...

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on 17 Jan 2017, 21:19 last edited by
              #6

              @Suares Have you actually confirmed that it doesn't get defined during compilation or are you just talking about the colorization in the editor? These can sometimes go out of sync.

              1 Reply Last reply
              1
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 17 Jan 2017, 21:22 last edited by
                #7

                Reading a file in an IDE is not a test.

                Like I wrote before, this file does a set of lengthy tests to determine what the compiler is capable of. Qt Creator can't get that in sync with the compiler(s) used to build your project.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • S Offline
                  S Offline
                  Suares
                  wrote on 17 Jan 2017, 21:45 last edited by
                  #8

                  @Chris-Kawa @SGaist

                  I've just checked noexcept, nullptr, ... specifiers instead of Q_DECL_NOEXCEPT, Q_NULLPTR, ... and everything is okay.
                  I thought if macros are disabled (without highlighting like in above image) then Qt didn't determine C++ features.

                  I think I can mark issue as resolved. Thank you!

                  1 Reply Last reply
                  0

                  1/8

                  16 Jan 2017, 20:03

                  • Login

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