diff options
Diffstat (limited to 'test/Analysis/member-expr.cpp')
-rw-r--r-- | test/Analysis/member-expr.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Analysis/member-expr.cpp b/test/Analysis/member-expr.cpp new file mode 100644 index 0000000..cf43738 --- /dev/null +++ b/test/Analysis/member-expr.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection %s -verify + +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}} + } +}
\ No newline at end of file |