If there were errors, disable 'unused' warnings since they will mostly be noise.
Fixes rdar://8736362.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124577 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/unused-with-error.cpp b/test/SemaCXX/unused-with-error.cpp
new file mode 100644
index 0000000..5660007
--- /dev/null
+++ b/test/SemaCXX/unused-with-error.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused -verify %s
+
+// Make sure 'unused' warnings are disabled when errors occurred.
+static void foo(int *X) { // expected-note {{candidate}}
+}
+void bar(const int *Y) {
+  foo(Y); // expected-error {{no matching function for call}}
+}