Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 // This is not well-formed C++ but used to crash in sema.
      4 
      5 template <class T>
      6 struct X {
      7   template <class U>
      8   struct A { // expected-note {{not-yet-instantiated member is declared here}}
      9     template <class V>
     10     struct B {
     11       template <class W>
     12       struct C {
     13         template <class X>
     14         struct D {
     15           template <class Y>
     16           struct E {
     17             template <class Z>
     18             void operator+=(Z);
     19           };
     20         };
     21       };
     22     };
     23   };
     24 
     25   template <class U>
     26   template <class V>
     27   template <class W>
     28   template <class X>
     29   template <class Y>
     30   template <class Z>
     31   friend void A<U>::template B<V>::template C<W>::template D<X>::template E<Y>::operator+=(Z); // expected-warning {{not supported}} expected-error {{no member 'A' in 'X<int>'; it has not yet been instantiated}}
     32 };
     33 
     34 void test() {
     35   X<int>::A<int>::B<int>::C<int>::D<int>::E<int>() += 1.0; // expected-note {{in instantiation of template class 'X<int>' requested here}}
     36 }
     37