I stumbled upon a C file (well, I wrote it :) that trips the parser for the 
symbol table. For a while, number literals in C++ and C can be partitioned 
visually by using single quotes, e.g., `0b0000'0000` - so-called digit 
separators. This has finally been standardized in C23 (and previously in C++14).

I have found that in case of initializing a subelement (e.g., a struct within 
an array of structs, i.e., within a second pair of curly braces), the quotes 
are not handled correctly. If the quotes appear in pairs it's fine which makes 
me think it tries to match them to find character literals.

See below for a demo. Notice how the function `test_func` vanishes from the 
symbol table depending on the amount of `'`s.

![Recording](https://github.com/user-attachments/assets/258830fa-4b49-456d-98ab-b0ba94c2ea9e)

I have only tested this with Geany 1.38. Here is the test case for easy 
verification:

    struct something arr[] = {
        {   0b0000'0000 },
    };

    void test_func(void) {
    }


-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/4078
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/issues/[email protected]>

Reply via email to