summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/cxx17-inline-variables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/cxx17-inline-variables.cpp')
-rw-r--r--test/SemaTemplate/cxx17-inline-variables.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaTemplate/cxx17-inline-variables.cpp b/test/SemaTemplate/cxx17-inline-variables.cpp
index 9e6761ee57aa..7fc0aa8eeeb0 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);