summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/cxx17-inline-variables.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-01-24 20:25:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-01-24 20:25:37 +0000
commit520a89e9d38bb1c9cc2de3f875eae3ac69f9f08a (patch)
tree54fe8463a6692d6f8706ee98bffde249b43eed0c /test/SemaTemplate/cxx17-inline-variables.cpp
parentead8c8e4f12a52fe33a395d4dce984c89ab04a77 (diff)
Notes
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);