Files
rk35xx-android14/external/clang/test/Analysis/member-expr.cpp
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

42 lines
869 B
C++

// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection %s -verify
void clang_analyzer_checkInlined(bool);
void clang_analyzer_eval(int);
namespace EnumsViaMemberExpr {
struct Foo {
enum E {
Bar = 1
};
};
void testEnumVal(Foo Baz) {
clang_analyzer_eval(Baz.Bar == Foo::Bar); // expected-warning{{TRUE}}
}
void testEnumRef(Foo &Baz) {
clang_analyzer_eval(Baz.Bar == Foo::Bar); // expected-warning{{TRUE}}
}
void testEnumPtr(Foo *Baz) {
clang_analyzer_eval(Baz->Bar == Foo::Bar); // expected-warning{{TRUE}}
}
}
namespace PR19531 {
struct A {
A() : x(0) {}
bool h() const;
int x;
};
struct B {
void g(bool (A::*mp_f)() const) {
// This used to trigger an assertion because the 'this' pointer is a
// temporary.
(A().*mp_f)();
}
void f() { g(&A::h); }
};
}