aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/gh56652.cpp
blob: 06a496e320bfc1d3bc54ad9ec0c42a90e4599f92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// RUN: %clang_cc1 -std=c++20 -triple x86_64-elf-gnu %s -emit-llvm -o - | FileCheck %s

namespace GH56652{

struct foo {};

template <typename T> struct bar {
    using type = T;

    template <foo> inline static constexpr auto b = true;
};

template <typename T>
concept C = requires(T a) { T::template b<foo{}>; };

template <typename T> auto fn(T) {
    if constexpr (!C<T>)
        return foo{};
    else
        return T{};
}

auto a = decltype(fn(bar<int>{})){};

}

namespace GH116319 {

template <int = 0> struct a {
template <class> static constexpr auto b = 2;
template <class> static void c() noexcept(noexcept(b<int>)) {}
};

void test() { a<>::c<int>(); }


}

// CHECK: %"struct.GH56652::bar" = type { i8 }
// CHECK: $_ZN8GH1163191aILi0EE1cIiEEvv = comdat any
// CHECK: @_ZN7GH566521aE = global %"struct.GH56652::bar" undef