| 1 |
// RUN: %clang_cc1 -std=c++20 -triple x86_64-elf-gnu %s -emit-llvm -o - | FileCheck %s |
| 2 |
|
| 3 |
namespace GH56652{ |
| 4 |
|
| 5 |
struct foo {}; |
| 6 |
|
| 7 |
template <typename T> struct bar { |
| 8 |
using type = T; |
| 9 |
|
| 10 |
template <foo> inline static constexpr auto b = true; |
| 11 |
}; |
| 12 |
|
| 13 |
template <typename T> |
| 14 |
concept C = requires(T a) { T::template b<foo{}>; }; |
| 15 |
|
| 16 |
template <typename T> auto fn(T) { |
| 17 |
if constexpr (!C<T>) |
| 18 |
return foo{}; |
| 19 |
else |
| 20 |
return T{}; |
| 21 |
} |
| 22 |
|
| 23 |
auto a = decltype(fn(bar<int>{})){}; |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
namespace GH116319 { |
| 28 |
|
| 29 |
template <int = 0> struct a { |
| 30 |
template <class> static constexpr auto b = 2; |
| 31 |
template <class> static void c() noexcept(noexcept(b<int>)) {} |
| 32 |
}; |
| 33 |
|
| 34 |
void test() { a<>::c<int>(); } |
| 35 |
|
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
// CHECK: %"struct.GH56652::bar" = type { i8 } |
| 40 |
// CHECK: $_ZN8GH1163191aILi0EE1cIiEEvv = comdat any |
| 41 |
// CHECK: @_ZN7GH566521aE = global %"struct.GH56652::bar" undef |