diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-20 20:23:38 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-20 20:23:38 +0000 |
commit | 1c9d5d956ce672946622958f1aaf3f66b6ed433b (patch) | |
tree | 73d8cd0a763545c8a3d64fe27f9740d0a975a7f6 /clang/test/SemaCXX/default-constructor-initializers.cpp | |
parent | 1771a852f0443d071e8dba643b49ffd5875143cd (diff) | |
download | bcm5719-llvm-1c9d5d956ce672946622958f1aaf3f66b6ed433b.tar.gz bcm5719-llvm-1c9d5d956ce672946622958f1aaf3f66b6ed433b.zip |
Made improvements in c++'s object model patch on Doug's review.
llvm-svn: 73833
Diffstat (limited to 'clang/test/SemaCXX/default-constructor-initializers.cpp')
-rw-r--r-- | clang/test/SemaCXX/default-constructor-initializers.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/default-constructor-initializers.cpp b/clang/test/SemaCXX/default-constructor-initializers.cpp new file mode 100644 index 00000000000..c5250f8912c --- /dev/null +++ b/clang/test/SemaCXX/default-constructor-initializers.cpp @@ -0,0 +1,56 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct X1 { // has no implicit default constructor + X1(int); +}; + +struct X2 : X1 { // expected-note {{'struct X2' declared here}} \ + // expected-note {{'struct X2' declared here}} + X2(int); +}; + +struct X3 : public X2 { +}; +X3 x3; // expected-error {{cannot define the default constructor for 'struct X3', because member 'struct X2' does not have any implicit default constructor}} + + +struct X4 { + X2 x2; + X2 & rx2; // expected-note {{declared at}} +}; + +X4 x4; // expected-error {{cannot define the default constructor for 'struct X4', because base class 'struct X2' does not have any implicit default constructor}} \ + // expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member rx2 cannot be default-initialized}} + + +struct Y1 { // has no implicit default constructor + Y1(int); +}; + +struct Y2 : Y1 { + Y2(int); + Y2(); +}; + +struct Y3 : public Y2 { +}; +Y3 y3; + +struct Y4 { + Y2 y2; +}; + +Y4 y4; + +// More tests + + +struct Z1 { + int& z; // expected-note {{declared at}} + const int c1; // expected-note {{declared at}} + volatile int v1; +}; + +Z1 z1; // expected-error {{cannot define the implicit default constructor for 'struct Z1', because reference member z cannot be default-initialized}} \ + // expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member c1 cannot be default-initialized}} + |