Aaron Ballman | 2c0bf24 | 2012-02-09 01:21:34 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -Wreturn-type -fsyntax-only -std=c++11 -verify %s |
| 2 | |
| 3 | class A { |
| 4 | public: |
| 5 | A(const A&); |
| 6 | }; |
| 7 | |
| 8 | struct S { |
| 9 | int i; |
| 10 | double d; |
| 11 | |
| 12 | virtual void B() {} |
| 13 | }; |
| 14 | |
| 15 | union U { |
| 16 | struct { |
| 17 | int i; |
| 18 | virtual void B() {} // Can only do this in C++11 |
| 19 | } t; |
| 20 | }; |
| 21 | |
| 22 | struct S2 { |
| 23 | int i; |
| 24 | double d; |
| 25 | }; |
| 26 | |
| 27 | extern "C" U f3( void ); // expected-warning {{'f3' has C-linkage specified, but returns user-defined type 'U' which is incompatible with C}} |
| 28 | extern "C" S f0(void); // expected-warning {{'f0' has C-linkage specified, but returns user-defined type 'S' which is incompatible with C}} |
| 29 | extern "C" A f4( void ); // expected-warning {{'f4' has C-linkage specified, but returns user-defined type 'A' which is incompatible with C}} |
| 30 | |
| 31 | // These should all be fine |
| 32 | extern "C" S2 f5( void ); |
| 33 | extern "C" void f2( A x ); |
| 34 | extern "C" void f6( S s ); |
| 35 | extern "C" void f7( U u ); |
| 36 | extern "C" double f8(void); |
| 37 | extern "C" long long f11( void ); |
| 38 | extern "C" A *f10( void ); |