Intellisense recognizes scopes wrong in some cases of using preprocessor commands and curly braces RRS feed

  • Question

  • Hi,

    I have this simple class in a header file:

    #pragma once
    class C
    	C () {};
    	int var1 =
    #ifdef AAA
    	int var2 = 0;

    the problem is that var2 is recognized as a global variable and does not appear in Class View under this class, instead it is listed under "Global Functions and Variables".

    Here is another example:

    #define test(expr) { expr }

    int main(int argc, char* argv[])
        test({ return 1; });

        int var = 2;

        return 0;
    Here var is recognized as global variable.
    It has definetly something to do with the curly braces, but I cant see a pattern. E.g if I remove them from the constructor C(), it recognizes the scopes fine.

    • Edited by Gertio Thursday, July 2, 2020 7:44 PM
    Thursday, July 2, 2020 7:04 PM

All replies