Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Issue or wish) Some versions of libclang on Windows silently ignores typedef of anonymous structs #322

Open
denizzzka opened this issue Nov 26, 2022 · 1 comment
Labels
good first issue Good issue for a beginner to take on help wanted

Comments

@denizzzka
Copy link

denizzzka commented Nov 26, 2022

libclang ver > (approx) 11.1.0 (and further above 16) only(!) on Windows silently ignores typedefs of anonymous structs like:

typedef struct { int i; } Foo;

as result, after parsing .dpp file like that:

#include "main.h"

void main() {}

unittest
{
    Foo f;
    f.i = 42;
    static assert(!__traits(compiles, _Anonymous_1(42)));
}

d++ returns only:

extern(C)
{
}

[...]

without Foo payload. I.e., it just skips constructions like this and not reports anything about.

I don't know why it is occurs, but it was very difficult to understand what this occurs because on Linux same header code works as it was intended and clang.exe on Windows also compiles this code as well, without any errors or warnings. Code like this also works fine:

typedef struct Foo { int i; } Foo;

All this cases is already covered by integration tests.

But I wish, at least, ask to add appropriate libclang version check into d++ and also add flag (like --ignore-libclang-version) for ignore this behaviour

@denizzzka
Copy link
Author

Addition:

Command to reproduce:

dub run dpp -- parsing.dpp --preprocess-only --hard-fail

dpp vresion ~master was used

Switching to C++ (--parse-as-cpp) also solves problem, but may add anothers, thus, can't be considered as solution

@atilaneves atilaneves added help wanted good first issue Good issue for a beginner to take on labels Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for a beginner to take on help wanted
Projects
None yet
Development

No branches or pull requests

2 participants