Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / over / over.over / p4-2a.cpp
blob9d0e7c463d43e845422811bfccd4e4446581acc1
1 // RUN: %clang_cc1 -std=c++2a -verify %s
3 template<typename T, typename U>
4 constexpr static bool is_same_v = false;
6 template<typename T>
7 constexpr static bool is_same_v<T, T> = true;
9 template<typename T>
10 concept AtLeast2 = sizeof(T) >= 2;
12 template<typename T>
13 concept AtMost8 = sizeof(T) <= 8;
15 template<typename T>
16 struct S {
17 static int foo() requires AtLeast2<long> && AtMost8<long> {
18 return 0;
21 static double foo() requires AtLeast2<char> {
22 return 0.0;
25 static char bar() requires AtLeast2<char> {
26 return 1.0;
29 static short bar() requires AtLeast2<long> && AtMost8<long> {
30 return 0.0;
33 static int bar() requires AtMost8<long> && AtLeast2<long> {
34 return 0.0;
37 static char baz() requires AtLeast2<char> {
38 return 1.0;
41 static short baz() requires AtLeast2<long> && AtMost8<long> {
42 return 0.0;
45 static int baz() requires AtMost8<long> && AtLeast2<long> {
46 return 0.0;
49 static long baz() requires AtMost8<long> && AtLeast2<long> && AtLeast2<short> {
50 return 3.0;
54 void a() {
55 static_assert(is_same_v<decltype(&S<int>::foo), int(*)()>);
56 static_assert(is_same_v<decltype(&S<int>::bar), long(*)()>);
57 // expected-error@-1{{reference to overloaded function could not be resolved; did you mean to call it?}}
58 static_assert(is_same_v<decltype(&S<int>::baz), long(*)()>);