Skip to content

Commit a89ebcd

Browse files
ozarsfoonathan
authored andcommitted
Use empty underlying type for aliases of anonymous types (standardese#83)
Fixes standardese#58
1 parent 55221f1 commit a89ebcd

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/libclang/type_parser.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ std::unique_ptr<cpp_type> parse_type_impl(const detail::parse_context& context,
637637
case CXType_Typedef:
638638
return make_leave_type(cur, type, [&](std::string&& spelling) {
639639
auto decl = clang_getTypeDeclaration(type);
640-
if (remove_prefix(spelling, "(anonymous", false))
640+
if (detail::cxstring(clang_getCursorSpelling(decl)).empty())
641641
spelling = ""; // anonymous type
642642
return cpp_user_defined_type::build(
643643
cpp_type_ref(detail::get_entity_id(decl), std::move(spelling)));

‎test/cpp_type_alias.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ typedef decltype(0) w;
509509
}
510510
else if (alias.name() == "v")
511511
{
512-
auto type = cpp_user_defined_type::build(cpp_type_ref(cpp_entity_id(""), "v"));
512+
auto type = cpp_user_defined_type::build(cpp_type_ref(cpp_entity_id(""), ""));
513513
REQUIRE(equal_types(idx, alias.underlying_type(), *type));
514514
return false;
515515
}

0 commit comments

Comments
 (0)