diff options
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r-- | test/SemaTemplate/alignas.cpp | 11 | ||||
-rw-r--r-- | test/SemaTemplate/cxx17-inline-variables.cpp | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/SemaTemplate/alignas.cpp b/test/SemaTemplate/alignas.cpp index 8a1f96e5bdec..680f07b32998 100644 --- a/test/SemaTemplate/alignas.cpp +++ b/test/SemaTemplate/alignas.cpp @@ -21,3 +21,14 @@ struct C { char a[16]; }; static_assert(sizeof(my_union<A, B, C>) == 16, ""); static_assert(alignof(my_union<A, B, C>) == 8, ""); + +namespace PR35028 { + template<class X, int Alignment> struct alignas(X) alignas(long long) alignas(long double) alignas(Alignment) Aligned { + union { + long long align1; + long double align2; + char data[sizeof(X)]; + }; + }; + Aligned<int, 1> a; +} 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); |