This commit is contained in:
parent
87ece5856a
commit
4ba00d0694
|
@ -1855,6 +1855,7 @@ namespace {
|
|||
std::string newScope1 = scope1;
|
||||
|
||||
// scopes didn't match so try higher scopes
|
||||
index = newScope1.size();
|
||||
while (!newScope1.empty()) {
|
||||
std::string::size_type separator = newScope1.rfind(" :: ", index - 1);
|
||||
if (separator != std::string::npos)
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
TEST_CASE(simplifyUsing9040);
|
||||
TEST_CASE(simplifyUsing9042);
|
||||
TEST_CASE(simplifyUsing9191);
|
||||
TEST_CASE(simplifyUsing9381);
|
||||
}
|
||||
|
||||
std::string tok(const char code[], bool simplify = true, Settings::PlatformType type = Settings::Native, bool debugwarnings = true) {
|
||||
|
@ -524,6 +525,30 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code, false));
|
||||
}
|
||||
|
||||
void simplifyUsing9381() {
|
||||
const char code[] = "namespace ns {\n"
|
||||
" class Result;\n"
|
||||
" using UniqueResultPtr = std::unique_ptr<Result>;\n"
|
||||
" class A {\n"
|
||||
" public:\n"
|
||||
" void func(UniqueResultPtr);\n"
|
||||
" };\n"
|
||||
" void A::func(UniqueResultPtr) {\n"
|
||||
" }\n"
|
||||
"}";
|
||||
const char exp[] = "namespace ns { "
|
||||
"class Result ; "
|
||||
"class A { "
|
||||
"public: "
|
||||
"void func ( std :: unique_ptr < Result > ) ; "
|
||||
"} ; "
|
||||
"void A :: func ( std :: unique_ptr < Result > ) { "
|
||||
"} "
|
||||
"}";
|
||||
|
||||
ASSERT_EQUALS(exp, tok(code, false));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSimplifyUsing)
|
||||
|
|
Loading…
Reference in New Issue