diff options
author | Anders Carlsson <andersca@mac.com> | 2009-03-25 02:58:17 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-03-25 02:58:17 +0000 |
commit | 75fdaa465f4ccbe129ad69cdc8de34587066db13 (patch) | |
tree | fd18ba15744d66e01285fba3ef36583adbe50b73 /clang/test/SemaCXX/constructor-initializer.cpp | |
parent | 3cfc2e214a20998e0e4f81ec70e75fe9c0fb9e77 (diff) | |
download | bcm5719-llvm-75fdaa465f4ccbe129ad69cdc8de34587066db13.tar.gz bcm5719-llvm-75fdaa465f4ccbe129ad69cdc8de34587066db13.zip |
Improve handling of base initializers. We now parse initializers in out of line decls, such as:
class C {
C() { }
int a;
};
C::C() : a(10) { }
We also diagnose when initializers are used on declarations that aren't constructors:
t.cpp:1:10: error: only constructors take base initializers
void f() : a(10) { }
^
Doug and/or Sebastian: I'd appreciate a review, especially the nested-name-spec test results (from the looks of it we now match gcc in that test.)
llvm-svn: 67672
Diffstat (limited to 'clang/test/SemaCXX/constructor-initializer.cpp')
-rw-r--r-- | clang/test/SemaCXX/constructor-initializer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp index 81d56eac9c3..d0c978a80d1 100644 --- a/clang/test/SemaCXX/constructor-initializer.cpp +++ b/clang/test/SemaCXX/constructor-initializer.cpp @@ -45,3 +45,12 @@ public: class G : A { G() : A(10); // expected-error{{expected '{'}} }; + +void f() : a(242) { } // expected-error{{only constructors take base initializers}} + +class H : A { + H(); +}; + +H::H() : A(10) { } + |