rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

error[E0412]: cannot find type `_CharT` in this scope

Open ctaggart opened this issue 8 years ago • 2 comments

This looks similar to #798, but I'm not sure if it is the same. I'm working on bindings for Octave and this comes up from the gcc headers related to std::string. https://github.com/ctaggart/octh/issues/8

Input C/C++ Header

template <typename, typename = int> class a;
template <typename _CharT> class b { _CharT c; };
template <typename _CharT, typename> class a : b<_CharT> { class B; };
template <typename _CharT, typename d> class a<_CharT, d>::B {
  a<_CharT, d> e;
};
class octave_diary_stream : a<char> {};

Bindgen Invocation

#!/usr/bin/env bash
set -eu
clang-3.9 --std=c++11 -c __bindgen.ii

~/rust-bindgen/target/release/bindgen \
    --output __bindgen.rs \
    --enable-cxx-namespaces \
    --whitelist-type octave.* \
    --whitelist-function octave.* \
    --use-core \
    --raw-line "extern crate core;" \
    __bindgen.ii \
    -- -v -x c++ -std=c++11 \
    2>/dev/null

rustc __bindgen.rs \
    2>&1 \
    | grep 'error\[E0412\]: cannot find type `_CharT` in this scope'

# time creduce ./bindgen-octh-8.sh __bindgen.ii

Actual Results

error[E0412]: cannot find type `_CharT` in this scope

Expected Results

No error. Either _CharT is defined or replaced.

ctaggart avatar Oct 01 '17 08:10 ctaggart

Thanks for the bug report @ctaggart !

fitzgen avatar Oct 02 '17 16:10 fitzgen

Also having on https://github.com/rust-lang/rust-bindgen/issues/2141

lukaz-vaultree-com avatar Dec 20 '21 09:12 lukaz-vaultree-com