diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 056abd2059c65a3e908193aeae16fad98017437c (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/SemaCXX/cxx11-crashes.cpp | |
parent | cc73504950eb7b5dff2dded9bedd67bc36d64641 (diff) | |
download | FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'test/SemaCXX/cxx11-crashes.cpp')
-rw-r--r-- | test/SemaCXX/cxx11-crashes.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx11-crashes.cpp b/test/SemaCXX/cxx11-crashes.cpp new file mode 100644 index 0000000..bd51af1 --- /dev/null +++ b/test/SemaCXX/cxx11-crashes.cpp @@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +// rdar://12240916 stack overflow. +namespace rdar12240916 { + +struct S2 { + S2(const S2&); + S2(); +}; + +struct S { // expected-note {{not complete}} + S x; // expected-error {{incomplete type}} + S2 y; +}; + +S foo() { + S s; + return s; +} + +struct S3; // expected-note {{forward declaration}} + +struct S4 { + S3 x; // expected-error {{incomplete type}} + S2 y; +}; + +struct S3 { + S4 x; + S2 y; +}; + +S4 foo2() { + S4 s; + return s; +} + +} + +// rdar://12542261 stack overflow. +namespace rdar12542261 { + +template <class _Tp> +struct check_complete +{ + static_assert(sizeof(_Tp) > 0, "Type must be complete."); +}; + + +template<class _Rp> +class function // expected-note 2 {{candidate}} +{ +public: + template<class _Fp> + function(_Fp, typename check_complete<_Fp>::type* = 0); // expected-note {{candidate}} +}; + +void foobar() +{ + auto LeftCanvas = new Canvas(); // expected-error {{unknown type name}} + function<void()> m_OnChange = [&, LeftCanvas]() { }; // expected-error {{no viable conversion}} +} + +} + +namespace b6981007 { + struct S {}; // expected-note 3{{candidate}} + void f() { + S s(1, 2, 3); // expected-error {{no matching}} + for (auto x : s) { + // We used to attempt to evaluate the initializer of this variable, + // and crash because it has an undeduced type. + const int &n(x); + } + } +} |