Fix compilation errors

This commit is contained in:
Jonathan Müller 2017-10-30 09:47:32 +01:00
commit 478fd4e90c
3 changed files with 16 additions and 12 deletions

View file

@ -116,7 +116,7 @@ namespace
detail::parse_type(context, cur, type), detail::parse_type(context, cur, type),
is_variadic, std::move(def)); is_variadic, std::move(def));
result->add_attribute(attributes); result->add_attribute(attributes);
return result; return std::move(result);
} }
std::unique_ptr<cpp_template_template_parameter> parse_template_parameter( std::unique_ptr<cpp_template_template_parameter> parse_template_parameter(

View file

@ -769,5 +769,5 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_type_alias(const detail::parse_con
result->add_attribute(detail::parse_attributes(stream)); result->add_attribute(detail::parse_attributes(stream));
} }
return result; return std::move(result);
} }

View file

@ -45,8 +45,7 @@ alignas(type) int var;
auto check_attribute = [](const cpp_attribute& attr, const char* name, auto check_attribute = [](const cpp_attribute& attr, const char* name,
type_safe::optional<std::string> scope, bool variadic, type_safe::optional<std::string> scope, bool variadic,
const char* args = "", const char* args, cpp_attribute_kind kind) {
cpp_attribute_kind kind = cpp_attribute_kind::unknown) {
REQUIRE(attr.kind() == kind); REQUIRE(attr.kind() == kind);
REQUIRE(attr.name() == name); REQUIRE(attr.name() == name);
REQUIRE(attr.scope() == scope); REQUIRE(attr.scope() == scope);
@ -71,27 +70,32 @@ alignas(type) int var;
REQUIRE(has_attribute(e, "attribute1")); REQUIRE(has_attribute(e, "attribute1"));
REQUIRE(has_attribute(e, "attribute2")); REQUIRE(has_attribute(e, "attribute2"));
check_attribute(attr, "attribute1", type_safe::nullopt, check_attribute(attr, "attribute1", type_safe::nullopt,
false); false, "", cpp_attribute_kind::unknown);
check_attribute(attributes[1u], "attribute2", check_attribute(attributes[1u], "attribute2",
type_safe::nullopt, false); type_safe::nullopt, false, "",
cpp_attribute_kind::unknown);
} }
else if (e.name() == "c") else if (e.name() == "c")
check_attribute(attr, "variadic", type_safe::nullopt, check_attribute(attr, "variadic", type_safe::nullopt, true,
true); "", cpp_attribute_kind::unknown);
else if (e.name() == "d") else if (e.name() == "d")
{ {
REQUIRE(has_attribute(e, "ns::attribute")); REQUIRE(has_attribute(e, "ns::attribute"));
check_attribute(attr, "attribute", "ns", false); check_attribute(attr, "attribute", "ns", false, "",
cpp_attribute_kind::unknown);
} }
else if (e.name() == "e") else if (e.name() == "e")
check_attribute(attr, "attribute", type_safe::nullopt, check_attribute(attr, "attribute", type_safe::nullopt,
false, R"(arg1,arg2,+(){},42,"Hello!")"); false, R"(arg1,arg2,+(){},42,"Hello!")",
cpp_attribute_kind::unknown);
else if (e.name() == "f") else if (e.name() == "f")
{ {
REQUIRE(attributes.size() == 2u); REQUIRE(attributes.size() == 2u);
check_attribute(attr, "attribute", "ns", false, "+,-,0 4"); check_attribute(attr, "attribute", "ns", false, "+,-,0 4",
cpp_attribute_kind::unknown);
check_attribute(attributes[1u], "other_attribute", check_attribute(attributes[1u], "other_attribute",
type_safe::nullopt, false); type_safe::nullopt, false, "",
cpp_attribute_kind::unknown);
} }
else if (e.name() == "g") else if (e.name() == "g")
{ {