Fix shadow warnings in string_view tests. Patch from STL@microsoft.com

llvm-svn: 285011
This commit is contained in:
Eric Fiselier 2016-10-24 20:10:00 +00:00
parent 2bf4a14b3e
commit 009fb08d14
2 changed files with 20 additions and 22 deletions

View File

@ -120,11 +120,10 @@ int main()
test_npos(S(), SV("12345"), 5, S(""));
test_npos(S(), SV("12345"), 6, S("not happening"));
}
{
typedef std::string S;
typedef std::string_view SV;
S s;
SV sv = "EFGH";
std::string s;
std::string_view sv = "EFGH";
char arr[] = "IJKL";
s.append("CDEF", 0); // calls append(const char *, len)
@ -138,7 +137,7 @@ int main()
s.append(sv, 0); // calls append(T, pos, npos)
assert(s == sv);
s.clear();
s.append(sv, 0, std::string::npos); // calls append(T, pos, npos)
assert(s == sv);
s.clear();
@ -154,10 +153,11 @@ int main()
s.append(arr, 0); // calls append(const char *, len)
assert(s == "");
s.clear();
}
{
S s = "ABCD";
SV sv = s;
std::string s = "ABCD";
std::string_view sv = s;
s.append(sv);
assert(s == "ABCDABCD");
@ -169,10 +169,10 @@ int main()
s.append(sv, sv.size());
assert(s == "ABCDABCDABCDABCD");
}
{
S s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
SV sv = s;
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string_view sv = s;
s.append(sv);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
@ -180,5 +180,4 @@ int main()
s.append(sv, 0, std::string::npos);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
}

View File

@ -119,11 +119,10 @@ int main()
test_npos(S(), SV("12345"), 5, S(""));
test_npos(S(), SV("12345"), 6, S("not happening"));
}
{
typedef std::string S;
typedef std::string_view SV;
S s = "ABCD";
SV sv = "EFGH";
std::string s = "ABCD";
std::string_view sv = "EFGH";
char arr[] = "IJKL";
s.assign("CDEF", 0); // calls assign(const char *, len)
@ -137,7 +136,7 @@ int main()
s.assign(sv, 0); // calls assign(T, pos, npos)
assert(s == sv);
s.clear();
s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos)
assert(s == sv);
s.clear();
@ -153,10 +152,11 @@ int main()
s.assign(arr, 0); // calls assign(const char *, len)
assert(s == "");
s.clear();
}
{
S s = "ABCD";
SV sv = s;
std::string s = "ABCD";
std::string_view sv = s;
s.assign(sv);
assert(s == "ABCD");
@ -164,10 +164,10 @@ int main()
s.assign(sv, 0, std::string::npos);
assert(s == "ABCD");
}
{
S s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
SV sv = s;
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string_view sv = s;
s.assign(sv);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
@ -175,5 +175,4 @@ int main()
s.assign(sv, 0, std::string::npos);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
}