diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-23 23:32:59 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-23 23:32:59 +0000 |
commit | ca2f085a4e1bc52a23b75cf95e54fe79758d9400 (patch) | |
tree | f89719453f33672b03f4a6ce663f20335c22699b /clang/test/SemaCXX/constructor-initializer.cpp | |
parent | 909f6001e9b6f8a05164e890ac3a9f856d0a69ab (diff) | |
download | bcm5719-llvm-ca2f085a4e1bc52a23b75cf95e54fe79758d9400.tar.gz bcm5719-llvm-ca2f085a4e1bc52a23b75cf95e54fe79758d9400.zip |
Diagnose when base classes and members to be intialized
with constructors don't have a matching constructor.
llvm-svn: 76913
Diffstat (limited to 'clang/test/SemaCXX/constructor-initializer.cpp')
-rw-r--r-- | clang/test/SemaCXX/constructor-initializer.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp index 66a5f57e1c1..71d38a1438b 100644 --- a/clang/test/SemaCXX/constructor-initializer.cpp +++ b/clang/test/SemaCXX/constructor-initializer.cpp @@ -96,3 +96,23 @@ struct Current : Derived { INT::NonExisting() {} // expected-error {{expected a class or namespace}} \ // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}} }; + + // FIXME. This is bad message! +struct M { // expected-note {{candidate function}} \ + // expected-note {{candidate function}} + M(int i, int j); // expected-note {{candidate function}} \ + // // expected-note {{candidate function}} +}; + +struct N : M { + N() : M(1), // expected-error {{no matching constructor for initialization of 'M'}} + m1(100) { } // expected-error {{no matching constructor for initialization of 'm1'}} + M m1; +}; + +struct P : M { // expected-error {{default constructor for 'struct M' is missing in initialization of base class}} + P() { } + M m; // expected-error {{default constructor for 'struct M' is missing in initialization of mamber}} +}; + + |