[Github] Label lldb-dap PRs (#125139)
[llvm-project.git] / clang / test / PCH / race-condition.cpp
blob752b0cc3ff6286acd1bc4966a57b3562d90dbfc1
1 // RUN: %clang_cc1 -fallow-pch-with-compiler-errors -std=c++20 -x c++-header -emit-pch %s -o %t -verify
2 // RUN: %clang_cc1 -fallow-pch-with-compiler-errors -std=c++20 -include-pch %t %s -verify
3 #ifndef HEADER_H
4 #define HEADER_H
6 #include "bad_include.h"
7 // expected-error@6{{'bad_include.h' file not found}}
9 template <bool, class = void> struct enable_if {};
10 template <class T> struct enable_if<true, T> { typedef T type; };
11 template <bool B, class T = void> using enable_if_t = typename enable_if<B, T>::type;
13 template <typename> struct meta { static constexpr int value = 0; };
14 template <> struct meta<int> { static constexpr int value = 1; };
15 template <> struct meta<float> { static constexpr int value = 2; };
17 namespace N {
18 inline namespace inner {
20 template <class T>
21 constexpr enable_if_t<meta<T>::value == 0, void> midpoint(T) {}
23 template <class U>
24 constexpr enable_if_t<meta<U>::value == 1, void> midpoint(U) {}
26 template <class F>
27 constexpr enable_if_t<meta<F>::value == 2, void> midpoint(F) {}
29 } // namespace inner
30 } // namespace N
32 #else
34 // expected-error@27{{'N::midpoint' has different definitions in different modules; defined here first difference is 1st parameter with type 'F'}}
35 // expected-error@24{{'N::midpoint' has different definitions in different modules; defined here first difference is 1st parameter with type 'U'}}
36 // expected-note@21{{but in '' found 1st parameter with type 'T'}}
37 int x = N::something;
38 // expected-error@37{{no member named 'something' in namespace 'N'}}
39 // expected-note@21{{but in '' found 1st parameter with type 'T'}}
41 #endif