summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/diagnostic-order.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/diagnostic-order.cpp')
-rw-r--r--clang/test/SemaCXX/diagnostic-order.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/diagnostic-order.cpp b/clang/test/SemaCXX/diagnostic-order.cpp
new file mode 100644
index 00000000000..f0899018f7f
--- /dev/null
+++ b/clang/test/SemaCXX/diagnostic-order.cpp
@@ -0,0 +1,20 @@
+// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s
+
+// Ensure that the diagnostics we produce for this situation appear in a
+// deterministic order. This requires ADL to provide lookup results in a
+// deterministic order.
+template<typename T> struct Error { typedef typename T::error error; };
+struct X { template<typename T> friend typename Error<T>::error f(X, T); };
+struct Y { template<typename T> friend typename Error<T>::error f(T, Y); };
+
+void g() {
+ f(X(), Y());
+}
+
+// We don't really care which order these two diagnostics appear (although the
+// order below is source order, which seems best). The crucial fact is that
+// there is one single order that is stable across multiple runs of clang.
+//
+// CHECK: no type named 'error' in 'Y'
+// CHECK: no type named 'error' in 'X'
+// CHECK: no matching function for call to 'f'
OpenPOWER on IntegriCloud