You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug extern_cpp_type!() accepts a single name as an argument, but autocxx uses two different names for nested types: outer_inner and outer::inner. As far as I’m aware, that means there’s no way to use extern_cpp_type!() for nested classes.
To Reproduce
// test.hpp
#pragma once
namespacemyns {
structmystruct {
enum myenum { A, B };
mystruct(myenum) {}
};
};
// build.rsfnmain(){let path = ".";letmut b = autocxx_build::Builder::new("src/main.rs",&[path]).build().unwrap();
b.flag_if_supported("-std=c++20").compile("minimal-repro");println!("cargo::rerun-if-changed=src/main.rs");}
// src/main.rsuse autocxx::prelude::*;#[cxx::bridge]mod manual {#[repr(u32)]pubenummystruct_myenum{A,B,}}include_cpp!{
#include "test.hpp"
safety!(unsafe)// variant 1: ParseError(AutocxxCodegenError(Conversion(Cpp(DidNotGenerateAnything("myns::mystruct::myenum")))))
extern_cpp_type!("myns::mystruct::myenum",crate::manual::mystruct_myenum)
pod!("myns::mystruct::myenum")// variant 2: cargo:warning=/.../autocxx-build-dir/cxx/gen1.cxx:178:79: error: 'myns::mystruct_myenum' has not been declared
extern_cpp_type!("myns::mystruct_myenum",crate::manual::mystruct_myenum)
pod!("myns::mystruct_myenum")// variant 3: cargo:warning=/.../autocxx-build-dir/cxx/gen1.cxx:137:79: error: 'myns::mystruct_myenum' has not been declared
extern_cpp_type!("myns::mystruct_myenum",crate::manual::mystruct_myenum)// variant 4: generates, but uses autocxx-generated enum in constructor instead of extern one
extern_cpp_type!("myns::mystruct::myenum",crate::manual::mystruct_myenum)
generate!("myns::mystruct")}fnmain(){println!("Hello, world!");}
Expected behavior
There’s some way to specify extern_cpp_type!() for a nested enum.
The text was updated successfully, but these errors were encountered:
Describe the bug
extern_cpp_type!()
accepts a single name as an argument, but autocxx uses two different names for nested types:outer_inner
andouter::inner
. As far as I’m aware, that means there’s no way to useextern_cpp_type!()
for nested classes.To Reproduce
Expected behavior
There’s some way to specify
extern_cpp_type!()
for a nested enum.The text was updated successfully, but these errors were encountered: