Fixed handling of template class specializations nested in other classes

This commit is contained in:
Bartek Kryza
2023-03-04 15:02:35 +01:00
parent d4d749ae34
commit a58b633d01
5 changed files with 71 additions and 11 deletions

View File

@@ -32,5 +32,20 @@ struct D {
void add(int i) { ints.template_template.values.push_back(i); }
};
struct E {
template <typename ET> struct nested_template {
using DT = ET;
static DT *get(ET *d) { return d; }
};
};
template <> struct E::nested_template<char> {
using DeclType = char;
static DeclType *getDecl(char *c) { return c; }
};
} // namespace t00008
} // namespace clanguml

View File

@@ -48,5 +48,12 @@ TEST_CASE("t00008", "[test-case][class]")
// REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator")));
REQUIRE_THAT(puml, (IsField<Public>("comparator", "CMP")));
REQUIRE_THAT(puml, !IsClass(_A("E::nested_template")));
REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "ET"));
REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "char"));
REQUIRE_THAT(puml,
IsInstantiation(
_A("E::nested_template<ET>"), _A("E::nested_template<char>")));
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
}