annotate clang/test/SemaTemplate/cxx17-inline-variables.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -std=c++17 -verify %s
anatofuz
parents:
diff changeset
2 // expected-no-diagnostics
anatofuz
parents:
diff changeset
3 template<bool> struct DominatorTreeBase {
anatofuz
parents:
diff changeset
4 static constexpr bool IsPostDominator = true;
anatofuz
parents:
diff changeset
5 };
anatofuz
parents:
diff changeset
6 extern template class DominatorTreeBase<false>;
anatofuz
parents:
diff changeset
7 constexpr bool k = DominatorTreeBase<false>::IsPostDominator;
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 namespace CompleteType {
anatofuz
parents:
diff changeset
10 template<unsigned N> constexpr int f(const bool (&)[N]) { return 0; }
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 template<bool ...V> struct X {
anatofuz
parents:
diff changeset
13 static constexpr bool arr[] = {V...};
anatofuz
parents:
diff changeset
14 static constexpr int value = f(arr);
anatofuz
parents:
diff changeset
15 };
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 constexpr int n = X<true>::value;
anatofuz
parents:
diff changeset
18 }
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 template <typename T> struct A {
anatofuz
parents:
diff changeset
21 static const int n;
anatofuz
parents:
diff changeset
22 static const int m;
anatofuz
parents:
diff changeset
23 constexpr int f() { return n; }
anatofuz
parents:
diff changeset
24 constexpr int g() { return n; }
anatofuz
parents:
diff changeset
25 };
anatofuz
parents:
diff changeset
26 template <typename T> constexpr int A<T>::n = sizeof(A) + sizeof(T);
anatofuz
parents:
diff changeset
27 template <typename T> inline constexpr int A<T>::m = sizeof(A) + sizeof(T);
anatofuz
parents:
diff changeset
28 static_assert(A<int>().f() == 5);
anatofuz
parents:
diff changeset
29 static_assert(A<int>().g() == 5);