From f92f6454efbd2b6cacbc563ffa131e165eba06a0 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 24 May 2012 21:05:41 +0000 Subject: A minor tweak to the new volatile lvalue warning: don't warn on "(void)x", where "x" refers to a local variable. This should silence a useless warning in compiler-rt and other places. llvm-svn: 157414 --- clang/test/SemaCXX/unused.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/test/SemaCXX/unused.cpp') diff --git a/clang/test/SemaCXX/unused.cpp b/clang/test/SemaCXX/unused.cpp index b330d6ecf46..54898c828ec 100644 --- a/clang/test/SemaCXX/unused.cpp +++ b/clang/test/SemaCXX/unused.cpp @@ -30,5 +30,7 @@ namespace derefvolatile { void f(volatile char* x) { *x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}} (void)*x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}} + volatile char y = 10; + (void)y; // don't warn here, because it's a common pattern. } } -- cgit v1.2.3