aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/constructor-initializer.cpp8
-rw-r--r--test/SemaCXX/copy-assignment.cpp8
-rw-r--r--test/SemaCXX/illegal-member-initialization.cpp7
-rw-r--r--test/SemaCXX/overload-member-call.cpp2
-rw-r--r--test/SemaCXX/overloaded-operator.cpp2
5 files changed, 13 insertions, 14 deletions
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index 53f057ed0f..2efb7b9c21 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -104,8 +104,8 @@ struct M { // expected-note 2 {{candidate constructor (the implicit
};
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'}}
+ N() : M(1), // expected-error {{no matching constructor for initialization of 'struct M'}}
+ m1(100) { } // expected-error {{no matching constructor for initialization of 'struct M'}}
M m1;
};
@@ -116,8 +116,8 @@ struct P : M {
};
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 *'}}
+ Q() : f1(1,2), // expected-error {{excess elements in scalar initializer}}
+ pf(0.0) { } // expected-error {{cannot initialize a member subobject of type 'float *' with an rvalue of type 'double'}}
float f1;
float *pf;
diff --git a/test/SemaCXX/copy-assignment.cpp b/test/SemaCXX/copy-assignment.cpp
index 315e29a5b5..d7eb5cf1e6 100644
--- a/test/SemaCXX/copy-assignment.cpp
+++ b/test/SemaCXX/copy-assignment.cpp
@@ -47,22 +47,22 @@ struct ConvertibleToInt {
void test() {
A a, na;
- const A constA;
+ const A constA = A();
ConvertibleToA convertibleToA;
ConvertibleToConstA convertibleToConstA;
B b, nb;
- const B constB;
+ const B constB = B();
ConvertibleToB convertibleToB;
ConvertibleToBref convertibleToBref;
ConvertibleToConstB convertibleToConstB;
ConvertibleToConstBref convertibleToConstBref;
C c, nc;
- const C constC;
+ const C constC = C();
D d, nd;
- const D constD;
+ const D constD = D();
ConvertibleToInt convertibleToInt;
diff --git a/test/SemaCXX/illegal-member-initialization.cpp b/test/SemaCXX/illegal-member-initialization.cpp
index 1890dbc9b5..be5f91d51a 100644
--- a/test/SemaCXX/illegal-member-initialization.cpp
+++ b/test/SemaCXX/illegal-member-initialization.cpp
@@ -1,9 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
- A() : value(), cvalue() { } // expected-error {{cannot initialize the member to null in default constructor because reference member 'value' cannot be null-initialized}} \
- // expected-error {{constructor for 'struct A' must explicitly initialize the reference member 'value'}}
- int &value; // expected-note{{declared at}} {{expected-note{{declared at}}
+ A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}}
+ int &value;
const int cvalue;
};
@@ -18,7 +17,7 @@ struct X {
int &value; // expected-note{{declared at}}
const int cvalue; // expected-note{{declared at}}
B& b; // expected-note{{declared at}}
- const B cb; // expected-note{{declared at}}
+ const B cb; // expected-note{{declared here}}
};
diff --git a/test/SemaCXX/overload-member-call.cpp b/test/SemaCXX/overload-member-call.cpp
index 22416f3ea4..77d9965ab7 100644
--- a/test/SemaCXX/overload-member-call.cpp
+++ b/test/SemaCXX/overload-member-call.cpp
@@ -89,7 +89,7 @@ namespace test1 {
A a;
a.foo(4, "hello"); //expected-error {{no matching member function for call to 'foo'}}
- const A b;
+ const A b = A();
b.bar(0); //expected-error {{no matching member function for call to 'bar'}}
a.baz(b); //expected-error {{no matching member function for call to 'baz'}}
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 861d679c72..e07afe2020 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -344,7 +344,7 @@ namespace pr5900 {
int operator[](unsigned); // expected-note {{candidate}}
};
int test1() {
- const NonConstArray x;
+ const NonConstArray x = NonConstArray();
return x[0]; // expected-error {{no viable overloaded operator[] for type}}
}