-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Labels
Description
- cppast version: e5fa6b7
- parser:
libclang_parser - clang version: 14.0.0
Hi Jonathan,
thanks for making such a great library. I'm trying to get it running with my code base, but encountered another error.
I have two classes that reference each other. Parsing these files with cppast gives errors as below
Input:
N/A.hpp:
#pragma once
#include <cmath>
#include <cstdint>
namespace N{
struct B;
struct A {
float a;
N::B make_b() const;
};
}
#include <N/B.hpp>
inline N::B N::A::make_b() const{
return {};
}N/B.hpp
#pragma once
#include <cmath>
#include <cassert>
namespace N{
struct A;
struct B{
float b;
N::A make_a() const;
};
}
#include <N/A.hpp>
inline N::A N::B::make_a() const
{
return {};
}Input flags: -v -I /abs/path/to/base_of_N/ /abs/path/to/N/A.hpp
Output:
[preprocessor] [debug] /home/.../N/A.hpp:3: parsing include 'cmath'
[preprocessor] [debug] /home/.../N/A.hpp:4: parsing include 'cstdint'
[preprocessor] [debug] /home/.../N/A.hpp:17: parsing include 'N/B.hpp'
[preprocessor] [debug] /home/.../N/A.hpp:4: parsing include 'cstdint'
[preprocessor] [debug] /home/.../N/A.hpp:17: parsing include 'N/B.hpp'
[preprocessor] [warning] /home/.../N/A.hpp:4: unable to retrieve full path for include 'cstdint' (please file a bug report)
[preprocessor] [warning] /home/.../N/A.hpp:17: unable to retrieve full path for include 'N/B.hpp' (please file a bug report)
[libclang] [error] ./N/A.hpp:10: redefinition of 'A'
[libclang] [error] ./N/A.hpp:10: redefinition of 'A'
[libclang] [error] ./N/A.hpp:19: redefinition of 'make_b'
[libclang] [error] ./N/B.hpp:18: redefinition of 'make_a'
[libclang] [error] ./N/A.hpp:10: redefinition of 'A'
AST for './N/A.hpp':
The output differs if I pass a relative path to the input file:
Input flags: -v -I /abs/path/to/base_of_N/ N/A.hpp
Output:
[preprocessor] [debug] N/A.hpp:3: parsing include 'cmath'
[preprocessor] [debug] N/A.hpp:4: parsing include 'cstdint'
[preprocessor] [debug] N/A.hpp:17: parsing include 'N/B.hpp'
[libclang] [error] ./N/A.hpp:10: redefinition of 'A'
AST for './N/A.hpp':