Debian Codegraph @

gcc/testsuite/g++.dg/template/constant2.C

raw
1 // PR c++/49896
2
3 template<class C>
4 class test {
5 protected:
6 #if __SIZEOF_INT__ == 4
7 static const int versionConst = 0x80000000;
8 #elif __SIZEOF_INT__ == 2
9 static const int versionConst = 0x8000;
10 #elif __SIZEOF_INT__ == 1
11 static const int versionConst = 0x80;
12 #endif
13 enum { versionEnum = versionConst };
14 public:
15 int getVersion();
16 };
17
18 template<class C>
19 int test<C>::getVersion() {
20 return versionEnum;
21 }
22
23 class dummy_class {};
24
25 int main() {
26 test<dummy_class> t;
27 return t.getVersion();
28 }