Richard Smith | 6642bb3 | 2016-03-24 19:12:22 +0000 | [diff] [blame^] | 1 | // RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s |
| 2 | |
| 3 | // Ensure that the diagnostics we produce for this situation appear in a |
| 4 | // deterministic order. This requires ADL to provide lookup results in a |
| 5 | // deterministic order. |
| 6 | template<typename T> struct Error { typedef typename T::error error; }; |
| 7 | struct X { template<typename T> friend typename Error<T>::error f(X, T); }; |
| 8 | struct Y { template<typename T> friend typename Error<T>::error f(T, Y); }; |
| 9 | |
| 10 | void g() { |
| 11 | f(X(), Y()); |
| 12 | } |
| 13 | |
| 14 | // We don't really care which order these two diagnostics appear (although the |
| 15 | // order below is source order, which seems best). The crucial fact is that |
| 16 | // there is one single order that is stable across multiple runs of clang. |
| 17 | // |
| 18 | // CHECK: no type named 'error' in 'Y' |
| 19 | // CHECK: no type named 'error' in 'X' |
| 20 | // CHECK: no matching function for call to 'f' |