1 // RUN: %clang_analyze_cc1 -std=c++14 -analyzer-checker=core,debug.ExprInspection %s -verify
2 
3 void clang_analyzer_checkInlined(bool);
4 void clang_analyzer_eval(int);
5 
6 namespace EnumsViaMemberExpr {
7   struct Foo {
8     enum E {
9       Bar = 1
10     };
11   };
12 
testEnumVal(Foo Baz)13   void testEnumVal(Foo Baz) {
14     clang_analyzer_eval(Baz.Bar == Foo::Bar); // expected-warning{{TRUE}}
15   }
16 
testEnumRef(Foo & Baz)17   void testEnumRef(Foo &Baz) {
18     clang_analyzer_eval(Baz.Bar == Foo::Bar); // expected-warning{{TRUE}}
19   }
20 
testEnumPtr(Foo * Baz)21   void testEnumPtr(Foo *Baz) {
22     clang_analyzer_eval(Baz->Bar == Foo::Bar); // expected-warning{{TRUE}}
23   }
24 }
25 
26 namespace PR19531 {
27   struct A {
APR19531::A28     A() : x(0) {}
29     bool h() const;
30     int x;
31   };
32 
33   struct B {
gPR19531::B34     void g(bool (A::*mp_f)() const) {
35       // This used to trigger an assertion because the 'this' pointer is a
36       // temporary.
37       (A().*mp_f)();
38     }
fPR19531::B39     void f() { g(&A::h); }
40   };
41 }
42