From: Benjamin Kramer Date: Tue, 4 Aug 2015 15:18:16 +0000 (+0000) Subject: [Sema] Add a crazy test case for r243987 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=258d7f406146fb29b333516105dc285476b52297;p=clang [Sema] Add a crazy test case for r243987 It's not valid code (maybe it can be made valid, but I'm not sure how). To trigger the crash fixed in r243987 requires a friend function with more than four template parameter lists. With this test we have at least some coverage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243989 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/many-template-parameter-lists.cpp b/test/SemaCXX/many-template-parameter-lists.cpp new file mode 100644 index 0000000000..f98005c7e6 --- /dev/null +++ b/test/SemaCXX/many-template-parameter-lists.cpp @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// This is not well-formed C++ but used to crash in sema. + +template +struct X { + template + struct A { // expected-note {{not-yet-instantiated member is declared here}} + template + struct B { + template + struct C { + template + struct D { + template + struct E { + template + void operator+=(Z); + }; + }; + }; + }; + }; + + template + template + template + template + template + template + friend void A::template B::template C::template D::template E::operator+=(Z); // expected-warning {{not supported}} expected-error {{no member 'A' in 'X'; it has not yet been instantiated}} +}; + +void test() { + X::A::B::C::D::E() += 1.0; // expected-note {{in instantiation of template class 'X' requested here}} +}