| 1 |
// A version of alias-decl-79.C where defining-type-id of B and C |
| 2 |
// are not dependent and instead their vector_size attribute is. |
| 3 |
// PR c++/115897 |
| 4 |
// { dg-do compile { target c++11 } } |
| 5 |
|
| 6 |
template<class T, class U> |
| 7 |
struct is_same { static constexpr bool value = __is_same(T, U); }; |
| 8 |
|
| 9 |
#if __cpp_variable_templates |
| 10 |
template<class T, class U> |
| 11 |
constexpr bool is_same_v = __is_same(T, U); |
| 12 |
#endif |
| 13 |
|
| 14 |
template<class T> struct A; |
| 15 |
|
| 16 |
template<int N> |
| 17 |
void f() { |
| 18 |
using T = float; |
| 19 |
using B [[gnu::vector_size(N * sizeof(float))]] = T; |
| 20 |
static_assert(!is_same<T, B>::value, ""); |
| 21 |
static_assert(!is_same<A<T>, A<B>>::value, ""); |
| 22 |
#if __cpp_variable_templates |
| 23 |
static_assert(!is_same_v<T, B>, ""); |
| 24 |
static_assert(!is_same_v<A<T>, A<B>>, ""); |
| 25 |
#endif |
| 26 |
}; |
| 27 |
|
| 28 |
template<int N> |
| 29 |
void g() { |
| 30 |
using T = float*; |
| 31 |
using C [[gnu::vector_size(N * sizeof(float*))]] = T; |
| 32 |
static_assert(!is_same<T*, C>::value, ""); |
| 33 |
static_assert(!is_same<A<T*>, A<C>>::value, ""); |
| 34 |
#if __cpp_variable_templates |
| 35 |
static_assert(!is_same_v<T*, C>, ""); |
| 36 |
static_assert(!is_same_v<A<T*>, A<C>>, ""); |
| 37 |
#endif |
| 38 |
}; |
| 39 |
|
| 40 |
template void f<4>(); |
| 41 |
template void g<4>(); |