summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/cxx17-inline-variables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaTemplate/cxx17-inline-variables.cpp')
-rw-r--r--clang/test/SemaTemplate/cxx17-inline-variables.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/cxx17-inline-variables.cpp b/clang/test/SemaTemplate/cxx17-inline-variables.cpp
index 9e6761ee57a..7fc0aa8eeeb 100644
--- a/clang/test/SemaTemplate/cxx17-inline-variables.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud