1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s 28e8fb3be5bd78f0564444eca02b404566a5f3b5dAndy Gibbs// expected-no-diagnostics 3e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall 4e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCalltemplate <class T> struct A { 5e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall static T cond; 6e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall 7e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall template <class U> struct B { 8e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall static T twice(U value) { 9e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall return (cond ? value + value : value); 10e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall } 11e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall }; 12e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall}; 134967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarextern template bool A<bool>::cond; 14e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall 15e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCallint foo() { 16e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall A<bool>::cond = true; 17e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall return A<bool>::B<int>::twice(4); 18e29ba20148e9b7835ad463b39cd4ee9223eafbbfJohn McCall} 1921d53e179651657e243587b79234fe6fedfae71cDouglas Gregor 2021d53e179651657e243587b79234fe6fedfae71cDouglas Gregornamespace PR6376 { 2121d53e179651657e243587b79234fe6fedfae71cDouglas Gregor template<typename T> 2221d53e179651657e243587b79234fe6fedfae71cDouglas Gregor struct X { 2321d53e179651657e243587b79234fe6fedfae71cDouglas Gregor template<typename Y> 2457265e35292897e383d70bbd1d552209fac37b39Douglas Gregor struct Y1 { }; // 2521d53e179651657e243587b79234fe6fedfae71cDouglas Gregor }; 2621d53e179651657e243587b79234fe6fedfae71cDouglas Gregor 2721d53e179651657e243587b79234fe6fedfae71cDouglas Gregor template<> 2821d53e179651657e243587b79234fe6fedfae71cDouglas Gregor struct X<float> { 2921d53e179651657e243587b79234fe6fedfae71cDouglas Gregor template<typename Y> 3057265e35292897e383d70bbd1d552209fac37b39Douglas Gregor struct Y1 { }; 3121d53e179651657e243587b79234fe6fedfae71cDouglas Gregor }; 3221d53e179651657e243587b79234fe6fedfae71cDouglas Gregor 3321d53e179651657e243587b79234fe6fedfae71cDouglas Gregor template<typename T, typename U> 3457265e35292897e383d70bbd1d552209fac37b39Douglas Gregor struct Z : public X<T>::template Y1<U> { }; 3521d53e179651657e243587b79234fe6fedfae71cDouglas Gregor 3621d53e179651657e243587b79234fe6fedfae71cDouglas Gregor Z<float, int> z0; 3721d53e179651657e243587b79234fe6fedfae71cDouglas Gregor} 38