1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify 2 3 namespace use_after_instantiation { 4 template<int &R> struct A { static constexpr int &value = R; }; 5 S()6 template<typename = void> auto S() { 7 static int s; 8 return A<s>{}; 9 } 10 11 auto &s = decltype(S())::value; 12 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}} 21 }; 22 return A{}; 23 } 24 25 auto &t = decltype(T())::value; 26 #endif 27 } 28