summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/warn-unused-value.cpp
blob: 775c3cf01f243a6cd76fdfdd4c296432bd7a6218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value %s

// PR4806
namespace test0 {
  class Box {
  public:
    int i;
    volatile int j;
  };

  void doit() {
    // pointer to volatile has side effect (thus no warning)
    Box* box = new Box;
    box->i; // expected-warning {{expression result unused}}
    box->j;
  }
}
OpenPOWER on IntegriCloud