diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-21 00:25:33 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-21 00:25:33 +0000 |
commit | 3e9ea0b8cd7c4691d62e385245556be5fded58a7 (patch) | |
tree | 8d3cdf104638d1f1f22142146b64b5141958b350 /test/PCH/chain-cxx.cpp | |
parent | 28441e6cee11fe6c2b3e13980f81203d14e73202 (diff) |
C++ constant expression handling: eagerly instantiate static const integral data
members of class templates so that their values can be used in ICEs. This
required reverting r105465, to get such instantiated members to be included in
serialized ASTs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH/chain-cxx.cpp')
-rw-r--r-- | test/PCH/chain-cxx.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp index c42ee7d39e..0d50e61c5a 100644 --- a/test/PCH/chain-cxx.cpp +++ b/test/PCH/chain-cxx.cpp @@ -38,9 +38,12 @@ template<typename T> struct TestBaseSpecifiers2 : TestBaseSpecifiers<T> { }; template <typename T> struct TS3 { static const int value = 0; + static const int value2; }; template <typename T> const int TS3<T>::value; +template <typename T> +const int TS3<T>::value2 = 1; // Instantiate struct, but not value. struct instantiate : TS3<int> {}; @@ -96,8 +99,9 @@ struct TestBaseSpecifiers4 : TestBaseSpecifiers3 { }; struct A { }; struct B : A { }; -// Instantiate TS3's member. +// Instantiate TS3's members. static const int ts3m1 = TS3<int>::value; +extern int arr[TS3<int>::value2]; // Redefinition of typedef typedef int Integer; @@ -132,6 +136,7 @@ void test() { // Should have remembered that there is a definition. static const int ts3m2 = TS3<int>::value; +int arr[TS3<int>::value2]; //===----------------------------------------------------------------------===// #endif |