Debian Codegraph @

gcc/testsuite/g++.dg/ext/is_const.C

raw
1 // { dg-do compile { target c++11 } }
2
3 #define SA(X) static_assert((X),#X)
4
5 class ClassType { };
6 using cClassType = const ClassType;
7 using vClassType = volatile ClassType;
8 using cvClassType = const volatile ClassType;
9
10 // Positive tests.
11 SA(__is_const(const int));
12 SA(__is_const(const volatile int));
13 SA(__is_const(cClassType));
14 SA(__is_const(cvClassType));
15
16 // Negative tests.
17 SA(!__is_const(int));
18 SA(!__is_const(volatile int));
19 SA(!__is_const(ClassType));
20 SA(!__is_const(vClassType));