Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify |
| 2 | |
| 3 | class NonCopyable { |
| 4 | NonCopyable(const NonCopyable&); // expected-note 2 {{implicitly declared private here}} |
| 5 | }; |
| 6 | |
| 7 | void capture_by_copy(NonCopyable nc, NonCopyable &ncr) { |
| 8 | // FIXME: error messages should talk about capture |
Douglas Gregor | 8c50e7c | 2012-02-09 00:47:04 +0000 | [diff] [blame] | 9 | (void)[nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 10 | // expected-error{{lambda expressions are not supported yet}} |
Douglas Gregor | 8c50e7c | 2012-02-09 00:47:04 +0000 | [diff] [blame] | 11 | (void)[ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 12 | // expected-error{{lambda expressions are not supported yet}} |
| 13 | } |
| 14 | |
Douglas Gregor | 8c50e7c | 2012-02-09 00:47:04 +0000 | [diff] [blame] | 15 | struct NonTrivial { |
| 16 | NonTrivial(); |
| 17 | NonTrivial(const NonTrivial &); |
| 18 | ~NonTrivial(); |
| 19 | }; |
| 20 | |
| 21 | struct CopyCtorDefault { |
| 22 | CopyCtorDefault(const CopyCtorDefault&, NonTrivial nt = NonTrivial()); |
| 23 | |
| 24 | void foo() const; |
| 25 | }; |
| 26 | |
| 27 | void capture_with_default_args(CopyCtorDefault cct) { |
| 28 | (void)[=] () -> void { cct.foo(); }; // expected-error{{lambda expressions are not supported yet}} |
| 29 | } |
| 30 | |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 31 | // FIXME: arrays! |
Douglas Gregor | 3d23f788 | 2012-02-09 02:12:34 +0000 | [diff] [blame^] | 32 | |
| 33 | // Check for the expected non-static data members. |
| 34 | |
| 35 | struct ExpectedLayout { |
| 36 | char a; |
| 37 | short b; |
| 38 | }; |
| 39 | |
| 40 | template<typename T> void capture(const T&); |
| 41 | |
| 42 | void test_layout(char a, short b) { |
| 43 | auto x = [=] () -> void { // expected-error{{lambda expressions are not supported yet}} |
| 44 | capture(a); |
| 45 | capture(b); |
| 46 | }; |
| 47 | static_assert(sizeof(x) == sizeof(ExpectedLayout), "Layout mismatch!"); |
| 48 | } |