Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/alias-decl-79.C

raw
1 // PR c++/115897
2 // { dg-do compile { target c++11 } }
3
4 template<class T, class U>
5 struct is_same { static constexpr bool value = __is_same(T, U); };
6
7 #if __cpp_variable_templates
8 template<class T, class U>
9 constexpr bool is_same_v = __is_same(T, U);
10 #endif
11
12 template<class T> struct A;
13
14 template<class T>
15 void f() {
16 using B [[gnu::vector_size(16)]] = T;
17 static_assert(!is_same<T, B>::value, "");
18 static_assert(!is_same<A<T>, A<B>>::value, "");
19 #if __cpp_variable_templates
20 static_assert(!is_same_v<T, B>, "");
21 static_assert(!is_same_v<A<T>, A<B>>, "");
22 #endif
23 };
24
25 template<class T>
26 void g() {
27 using C [[gnu::vector_size(16)]] = T*;
28 static_assert(!is_same<T*, C>::value, "");
29 static_assert(!is_same<A<T*>, A<C>>::value, "");
30 #if __cpp_variable_templates
31 static_assert(!is_same_v<T*, C>, "");
32 static_assert(!is_same_v<A<T*>, A<C>>, "");
33 #endif
34 };
35
36 template void f<float>();
37 template void g<float>();