// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s // RUN: %clang_cc1 -fsyntax-only -std=c++1y -verify %s -DCXX1Y #ifndef CXX1Y template using alias_ref = T; template void func_ref() {} template struct class_ref {}; template struct U { static int a; }; template struct S; // expected-note 6{{here}} template int U::a = S::kError; // expected-error 6{{undefined}} template void f() { (void)alias_ref::a>(); // expected-note {{here}} (void)func_ref::a>(); // expected-note {{here}} (void)class_ref::a>(); // expected-note {{here}} }; template void not_instantiated() { // These cases (arguably) do not require instantiation of U::a. (void)alias_ref::a>(); (void)func_ref::a>(); (void)class_ref::a>(); }; template void fi() { (void)alias_ref::a>(); // expected-note {{here}} (void)func_ref::a>(); // expected-note {{here}} (void)class_ref::a>(); // expected-note {{here}} }; int main() { f(); // expected-note 3{{here}} fi<10>(); // expected-note 3{{here}} } namespace N { template struct S { static int n; }; template int S::n = 5; void g(int*); template int f() { int k[S::n]; g(k); return k[3]; } int j = f(); } #else // expected-no-diagnostics namespace { template extern int n; } template int g() { return n; } namespace { extern template int n; } #endif