diff options
author | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-06-01 10:47:49 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-06-01 10:47:49 +0200 |
commit | 8a10eb144638db5284c2720b2102ba551b1b07b3 (patch) | |
tree | 2f92f5f01a3752af0ca7dc8c47d82fdfad224b6e | |
parent | d5193135e4328f278785c7d7e950356ba9446244 (diff) |
gen: Don't generate constants of templated structs
They're tricky.
-rw-r--r-- | src/gen.rs | 2 | ||||
-rw-r--r-- | tests/headers/template.hpp | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -1239,7 +1239,7 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> items.push(mk_impl(ctx, id_ty, unmangledlist)); } - if !ci.vars.is_empty() { + if !ci.vars.is_empty() && template_args.is_empty() { let vars = ci.vars.into_iter().map(|v| { let vi = v.varinfo(); let v = vi.borrow_mut(); diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp index 29a0792b..c13643c3 100644 --- a/tests/headers/template.hpp +++ b/tests/headers/template.hpp @@ -137,3 +137,8 @@ class ReplacedWithDestructorDeclaredAfter { T* buff; ~ReplacedWithDestructorDeclaredAfter() {}; }; + +template<typename T> +class TemplateWithVar { + static T var = 0; +}; |