| 1 |
// RUN: %clang_cc1 -verify -std=c++98 %s |
| 2 |
// RUN: %clang_cc1 -verify -std=c++11 %s |
| 3 |
// RUN: %clang_cc1 -verify -std=c++14 %s |
| 4 |
// RUN: %clang_cc1 -verify -std=c++17 %s |
| 5 |
// RUN: %clang_cc1 -verify -std=c++20 %s |
| 6 |
// RUN: %clang_cc1 -verify -std=c++23 %s |
| 7 |
// RUN: %clang_cc1 -verify -std=c++2c %s |
| 8 |
|
| 9 |
// https://github.com/llvm/llvm-project/issues/67914 |
| 10 |
|
| 11 |
template < typename, int > |
| 12 |
struct Mask; |
| 13 |
|
| 14 |
template < int, class > |
| 15 |
struct conditional { |
| 16 |
using type = Mask< int, 16 >; // expected-warning 0+ {{}} |
| 17 |
}; |
| 18 |
|
| 19 |
template < class _Then > |
| 20 |
struct conditional< 0, _Then > { |
| 21 |
using type = _Then; // expected-warning 0+ {{}} |
| 22 |
}; |
| 23 |
|
| 24 |
template < int _Bp, class, class _Then > |
| 25 |
using conditional_t = typename conditional< _Bp, _Then >::type; // expected-warning 0+ {{}} |
| 26 |
|
| 27 |
template < typename, int > |
| 28 |
struct Array; |
| 29 |
|
| 30 |
template < typename, int, bool, typename > |
| 31 |
struct StaticArrayImpl; |
| 32 |
|
| 33 |
template < typename Value_, int Size_ > |
| 34 |
struct Mask : StaticArrayImpl< Value_, Size_, 1, Mask< Value_, Size_ > > { // expected-note 0+ {{}} |
| 35 |
template < typename T1 > |
| 36 |
Mask(T1) {} // expected-note 0+ {{}} |
| 37 |
}; |
| 38 |
|
| 39 |
template < typename T > |
| 40 |
void load(typename T::MaskType mask) { |
| 41 |
T::load_(mask); // expected-note 0+ {{}} |
| 42 |
} |
| 43 |
|
| 44 |
template < typename Value_, int IsMask_, typename Derived_ > |
| 45 |
struct StaticArrayImpl< Value_, 32, IsMask_, Derived_ > { |
| 46 |
using Array1 = conditional_t< IsMask_, void, Array< Value_, 16 > >; // expected-warning 0+ {{}} |
| 47 |
|
| 48 |
template < typename Mask > |
| 49 |
static Derived_ load_(Mask mask) { |
| 50 |
return Derived_{load< Array1 >(mask.a1), Mask{}}; // expected-error 0+ {{}} |
| 51 |
} |
| 52 |
|
| 53 |
Array1 a1; |
| 54 |
}; |
| 55 |
|
| 56 |
template < typename Derived_ > |
| 57 |
struct KMaskBase; |
| 58 |
|
| 59 |
template < typename Derived_ > |
| 60 |
struct StaticArrayImpl< float, 16, 0, Derived_ > { |
| 61 |
template < typename Mask > |
| 62 |
static Derived_ load_(Mask mask); |
| 63 |
}; |
| 64 |
|
| 65 |
template < typename Derived_ > |
| 66 |
struct StaticArrayImpl< float, 16, 1, Mask< float, 16 > > : KMaskBase< Derived_ > {}; // expected-error 0+ {{}} |
| 67 |
|
| 68 |
template < typename Derived_ > |
| 69 |
struct StaticArrayImpl< int, 16, 1, Derived_ > {}; |
| 70 |
|
| 71 |
template < typename Value_, int Size_ > |
| 72 |
struct Array : StaticArrayImpl< Value_, Size_, 0, Array< Value_, Size_ > > { |
| 73 |
using MaskType = Mask< Value_, Size_ >; // expected-warning 0+ {{}} |
| 74 |
}; |
| 75 |
|
| 76 |
void test11_load_masked() { |
| 77 |
load< Array< float, 32 > >{} == 0; // expected-error 0+ {{}} expected-warning 0+ {{}} expected-note 0+ {{}} |
| 78 |
} |