Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-13219

Preprocessor should expand macros that are passed to function-like macros in define

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • Qt Creator 3.4.0
    • Qt Creator 3.2.2, Qt Creator 3.3.0-beta1
    • C/C++/Obj-C++ Support
    • None

      Sorry for the long title

      When a #define references a function-like macro, and passes values to it, the values need to be expanded before they're passed to the function. This mostly affects concatenation operator.

      This behavior is different on calls from other statements which are not #defines.

      #define concat(x,y) x ## y
      #define xconcat(x,y) concat(x,y)
      
      #define NUM 42
      int foo1 = concat(0x, NUM); // should be expanded as 0xNUM, which of course won't compile
      int foo2 = xconcat(0x, NUM); // should be expanded as 0x42

        For Gerrit Dashboard: QTCREATORBUG-13219
        # Subject Branch Project Status CR V

            kosjar Nikolai Kosjar
            orgads Orgad Shaneh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes