From 668bf82658f44105d96ea8f780ec967e86c50fc7 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 27 Oct 2012 02:13:28 +0000 Subject: [PATCH] Add a test case for the stack overflow in rdar://12542261 llvm-svn: 166858 --- clang/test/SemaCXX/cxx11-crashes.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/clang/test/SemaCXX/cxx11-crashes.cpp b/clang/test/SemaCXX/cxx11-crashes.cpp index d5db10962f94..66b182bf7be0 100644 --- a/clang/test/SemaCXX/cxx11-crashes.cpp +++ b/clang/test/SemaCXX/cxx11-crashes.cpp @@ -36,3 +36,29 @@ S4 foo2() { } } + +// rdar://12542261 stack overflow. +namespace rdar12542261 { + +template +struct check_complete +{ + static_assert(sizeof(_Tp) > 0, "Type must be complete."); +}; + + +template +class function // expected-note 2 {{candidate}} +{ +public: + template + function(_Fp, typename check_complete<_Fp>::type* = 0); // expected-note {{candidate}} +}; + +void foobar() +{ + auto LeftCanvas = new Canvas(); // expected-error {{unknown type name}} + function m_OnChange = [&, LeftCanvas]() { }; // expected-error {{no viable conversion}} +} + +}