diff options
Diffstat (limited to 'test/SemaCXX/warn-unused-value.cpp')
-rw-r--r-- | test/SemaCXX/warn-unused-value.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-unused-value.cpp b/test/SemaCXX/warn-unused-value.cpp new file mode 100644 index 0000000..775c3cf --- /dev/null +++ b/test/SemaCXX/warn-unused-value.cpp @@ -0,0 +1,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; + } +} |