parent
0b62c73ff0
commit
7515305581
|
@ -1724,7 +1724,7 @@ private:
|
|||
errout.str());
|
||||
}
|
||||
|
||||
void array_index_59()
|
||||
void array_index_59() // #10413
|
||||
{
|
||||
check("long f(long b) {\n"
|
||||
" const long a[] = { 0, 1, };\n"
|
||||
|
@ -1734,6 +1734,22 @@ private:
|
|||
" return a[b];\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(int a, int b) {\n"
|
||||
" const int S[2] = {};\n"
|
||||
" if (a < 0) {}\n"
|
||||
" else {\n"
|
||||
" if (b < 0) {}\n"
|
||||
" else if (S[b] > S[a]) {}\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int a[2] = {};\n"
|
||||
"void f(int i) {\n"
|
||||
" g(i < 0 ? 0 : a[i]);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void array_index_60()
|
||||
|
|
|
@ -2790,7 +2790,7 @@ private:
|
|||
"struct D : public B { int f() override; };\n"
|
||||
"int g(B* p) {\n"
|
||||
" if (p) {\n"
|
||||
" auto d = dynamic_cast<B*>(p);\n"
|
||||
" auto d = dynamic_cast<D*>(p);\n"
|
||||
" return d ? d->f() : 0;\n"
|
||||
" }\n"
|
||||
" return 0;\n"
|
||||
|
|
Loading…
Reference in New Issue