Skip to content

Assertion failure !isValueDependent() triggered #2239

@chbaker0

Description

@chbaker0

When using bindgen with an assertions-enabled libclang build, the following code fails an assertion.

The assertion indicates either bindgen or the internals of libclang are requesting const eval of sizeof(c) which depends on a type parameter of the template.

Input C++ Header

template <class a> class b {
    a : sizeof(a);
};
Previous, less reduced case
template <class a> class b {
    typedef a c;
    struct {
        c : sizeof(c);
    };
};

Bindgen Invocation

cargo test on chbaker0@a17d868

Ignore the changes to Cargo.toml; that was just to link with a static libclang build.

Actual Results

tests-a8e2fa07fdd9a37d: /b/s/w/ir/cache/builder/src/third_party/llvm/clang/lib/AST/ExprConstant.cpp:15219: llvm::APSInt clang::Expr::EvaluateKnownConstInt(const clang::ASTContext &, SmallVectorImpl<clang::PartialDiagnosticAt> *) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.
error: test failed, to rerun pass '--test tests

Expected Results

No assertion failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions