Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / instantiate-static-local.cpp
blobdd139011ac6bdc9e572674291a6d6273ec421d1e
1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
3 namespace use_after_instantiation {
4 template<int &R> struct A { static constexpr int &value = R; };
6 template<typename = void> auto S() {
7 static int s;
8 return A<s>{};
11 auto &s = decltype(S())::value;
13 // This is ill-formed, but it should not crash.
14 // FIXME: Right now, it does crash.
15 // expected-no-diagnostics
16 #if 0
17 template<typename = void> auto T() {
18 static int s;
19 struct A {
20 static constexpr int &value = s; // expected-error {{static}}
22 return A{};
25 auto &t = decltype(T())::value;
26 #endif