1e31e606fSDouglas Gregor // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify 2e31e606fSDouglas Gregor 3*199cec76SDouglas Gregor template<typename T> void capture(const T&); 4*199cec76SDouglas Gregor 5e31e606fSDouglas Gregor class NonCopyable { 6e31e606fSDouglas Gregor NonCopyable(const NonCopyable&); // expected-note 2 {{implicitly declared private here}} 7e31e606fSDouglas Gregor }; 8e31e606fSDouglas Gregor 9e31e606fSDouglas Gregor void capture_by_copy(NonCopyable nc, NonCopyable &ncr) { 10e31e606fSDouglas Gregor // FIXME: error messages should talk about capture 118c50e7c5SDouglas Gregor (void)[nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ 12e31e606fSDouglas Gregor // expected-error{{lambda expressions are not supported yet}} 138c50e7c5SDouglas Gregor (void)[ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ 14e31e606fSDouglas Gregor // expected-error{{lambda expressions are not supported yet}} 15e31e606fSDouglas Gregor } 16e31e606fSDouglas Gregor 178c50e7c5SDouglas Gregor struct NonTrivial { 188c50e7c5SDouglas Gregor NonTrivial(); 198c50e7c5SDouglas Gregor NonTrivial(const NonTrivial &); 208c50e7c5SDouglas Gregor ~NonTrivial(); 218c50e7c5SDouglas Gregor }; 228c50e7c5SDouglas Gregor 238c50e7c5SDouglas Gregor struct CopyCtorDefault { 24*199cec76SDouglas Gregor CopyCtorDefault(); 258c50e7c5SDouglas Gregor CopyCtorDefault(const CopyCtorDefault&, NonTrivial nt = NonTrivial()); 268c50e7c5SDouglas Gregor 278c50e7c5SDouglas Gregor void foo() const; 288c50e7c5SDouglas Gregor }; 298c50e7c5SDouglas Gregor 308c50e7c5SDouglas Gregor void capture_with_default_args(CopyCtorDefault cct) { 318c50e7c5SDouglas Gregor (void)[=] () -> void { cct.foo(); }; // expected-error{{lambda expressions are not supported yet}} 328c50e7c5SDouglas Gregor } 338c50e7c5SDouglas Gregor 34*199cec76SDouglas Gregor struct ExpectedArrayLayout { 35*199cec76SDouglas Gregor CopyCtorDefault array[3]; 36*199cec76SDouglas Gregor }; 37*199cec76SDouglas Gregor 38*199cec76SDouglas Gregor void capture_array() { 39*199cec76SDouglas Gregor CopyCtorDefault array[3]; 40*199cec76SDouglas Gregor auto x = [=]() -> void { // expected-error{{lambda expressions are not supported yet}} 41*199cec76SDouglas Gregor capture(array[0]); 42*199cec76SDouglas Gregor }; 43*199cec76SDouglas Gregor static_assert(sizeof(x) == sizeof(ExpectedArrayLayout), "layout mismatch"); 44*199cec76SDouglas Gregor } 453d23f788SDouglas Gregor 463d23f788SDouglas Gregor // Check for the expected non-static data members. 473d23f788SDouglas Gregor 483d23f788SDouglas Gregor struct ExpectedLayout { 493d23f788SDouglas Gregor char a; 503d23f788SDouglas Gregor short b; 513d23f788SDouglas Gregor }; 523d23f788SDouglas Gregor 533d23f788SDouglas Gregor void test_layout(char a, short b) { 543d23f788SDouglas Gregor auto x = [=] () -> void { // expected-error{{lambda expressions are not supported yet}} 553d23f788SDouglas Gregor capture(a); 563d23f788SDouglas Gregor capture(b); 573d23f788SDouglas Gregor }; 583d23f788SDouglas Gregor static_assert(sizeof(x) == sizeof(ExpectedLayout), "Layout mismatch!"); 593d23f788SDouglas Gregor } 60