diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-10 23:08:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-10 23:08:26 +0000 |
commit | 48cc498f2d5b241d4f54cb61f8e23949ecb8070b (patch) | |
tree | a8ee6434c55369082479f796a5c94b96e9e85939 /test/SemaTemplate/cxx17-inline-variables.cpp | |
parent | d6f5f01f7d59639b4f603ae9c16dcfc17c531c98 (diff) | |
download | clang-48cc498f2d5b241d4f54cb61f8e23949ecb8070b.tar.gz |
In C++17, when instantiating an out-of-line definition of an inline static data
member, don't forget to instantiate the initializer too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322236 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/cxx17-inline-variables.cpp')
-rw-r--r-- | test/SemaTemplate/cxx17-inline-variables.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaTemplate/cxx17-inline-variables.cpp b/test/SemaTemplate/cxx17-inline-variables.cpp index 9e6761ee57..7fc0aa8eee 100644 --- a/test/SemaTemplate/cxx17-inline-variables.cpp +++ b/test/SemaTemplate/cxx17-inline-variables.cpp @@ -16,3 +16,14 @@ namespace CompleteType { constexpr int n = X<true>::value; } + +template <typename T> struct A { + static const int n; + static const int m; + constexpr int f() { return n; } + constexpr int g() { return n; } +}; +template <typename T> constexpr int A<T>::n = sizeof(A) + sizeof(T); +template <typename T> inline constexpr int A<T>::m = sizeof(A) + sizeof(T); +static_assert(A<int>().f() == 5); +static_assert(A<int>().g() == 5); |