summaryrefslogtreecommitdiffstats
path: root/test/Analysis/member-expr.cpp
blob: cf437387d6a64012c62de4b772af0f37d37d4ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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}}
  }
}
OpenPOWER on IntegriCloud