Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / gh61159.cpp
blobd430d4c0b4cdd5c7073fc10557c55b64c804af95
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2 // expected-no-diagnostics
4 namespace GH61159 {
5 template <typename T> struct X {
6 struct I;
7 };
9 template <> struct X<int>::I {
10 template <int ct> constexpr int f() { return ct; };
12 int data = 3;
15 template <typename T> struct X<T>::I {
16 template <T ct> constexpr T f() { return ct + 1; };
17 T data = 7;
20 static_assert(X<int>::I{}.f<17>() == 17);
21 static_assert(X<int>::I{}.data == 3);
22 static_assert(X<short>::I{}.data == 7);
23 static_assert(X<short>::I{}.f<18>() == 19);
25 template <typename T> struct Y {
26 struct I;
29 template <> struct Y<int> {
30 struct I {
31 template <int ct> constexpr int f() { return ct; };
32 int data = 3;
36 static_assert(Y<int>::I{}.f<17>() == 17);
37 static_assert(Y<int>::I{}.data == 3);
39 } // namespace GH61159