summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/constructor-initializer.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
commit9092c3e0fa01f3139b016d05d267a89e3b07747a (patch)
tree137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/SemaCXX/constructor-initializer.cpp
parent4981926bf654fe5a2c3893f24ca44106b217e71e (diff)
downloadFreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.zip
FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.tar.gz
Update clang to r84119.
Diffstat (limited to 'test/SemaCXX/constructor-initializer.cpp')
-rw-r--r--test/SemaCXX/constructor-initializer.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index a180d90..b86a27d 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -1,7 +1,8 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: clang-cc -Wreorder -fsyntax-only -verify %s
class A {
int m;
A() : A::m(17) { } // expected-error {{member initializer 'm' does not name a non-static data member or base class}}
+ A(int);
};
class B : public A {
@@ -26,7 +27,7 @@ public:
class E : public D, public B {
public:
- E() : B(), D() { } // expected-error{{base class initializer 'B' names both a direct base class and an inherited virtual base class}}
+ E() : B(), D() { } // expected-error{{base class initializer 'class B' names both a direct base class and an inherited virtual base class}}
};
@@ -64,7 +65,7 @@ struct S : Y, virtual X {
};
struct Z : S {
- Z() : S(), X(), E() {} // expected-error {{type 'class E' is not a direct or virtual base of 'Z'}}
+ Z() : X(), S(), E() {} // expected-error {{type 'class E' is not a direct or virtual base of 'Z'}}
};
class U {
@@ -85,11 +86,39 @@ struct Derived : Base, Base1, virtual V {
struct Current : Derived {
int Derived;
- Current() : Derived(1), ::Derived(),
+ Current() : Derived(1), ::Derived(), // expected-warning {{member 'Derived' will be initialized after}} \
+ // expected-note {{base '::Derived'}} \
+ // expected-warning {{base class '::Derived' will be initialized after}}
::Derived::Base(), // expected-error {{type '::Derived::Base' is not a direct or virtual base of 'Current'}}
Derived::Base1(), // expected-error {{type 'Derived::Base1' is not a direct or virtual base of 'Current'}}
- Derived::V(),
+ Derived::V(), // expected-note {{base 'Derived::V'}}
::NonExisting(), // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
INT::NonExisting() {} // expected-error {{expected a class or namespace}} \
- // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
+ // 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 member}}
+};
+
+struct Q {
+ Q() : f1(1,2), // expected-error {{Too many arguments for member initializer 'f1'}}
+ pf(0.0) { } // expected-error {{incompatible type passing 'double', expected 'float *'}}
+ float f1;
+
+ float *pf;
};
OpenPOWER on IntegriCloud