Files
codeql/cpp/ql/test/library-tests/dataflow/fields/C.cpp
Jonas Jensen ed1e3ed1ef C++: Annotate field-flow tests in [ABC].cpp
This brings the annotation style in sync with how we annotate new tests
these days. I also changed a few annotations to have different expected
outcome based on my understanding of the code.
2019-08-15 10:30:46 +02:00

38 lines
516 B
C++

class C
{
class Elem
{
};
private:
Elem *s1 = new Elem();
const Elem *s2 = new Elem();
Elem *s3;
public:
const static Elem *s4;
void main(void)
{
C *c = new C();
c->func();
}
C() : s1(new Elem())
{
this->s3 = new Elem();
}
void func()
{
sink(s1); // flow [NOT DETECTED] (in either place)
sink(s2); // flow [NOT DETECTED]
sink(s3); // flow
sink(s4); // flow [NOT DETECTED]
}
static void sink(const void *o) {}
};
const C::Elem *C::s4 = new Elem();