summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/alignof-sizeof-reference.cpp6
-rw-r--r--test/SemaCXX/anonymous-union.cpp34
-rw-r--r--test/SemaCXX/attr-deprecated.cpp126
-rw-r--r--test/SemaCXX/blocks.cpp32
-rw-r--r--test/SemaCXX/c99-variable-length-array.cpp116
-rw-r--r--test/SemaCXX/c99.cpp5
-rw-r--r--test/SemaCXX/class.cpp23
-rw-r--r--test/SemaCXX/compare.cpp20
-rw-r--r--test/SemaCXX/conditional-expr.cpp37
-rw-r--r--test/SemaCXX/constant-expression.cpp4
-rw-r--r--test/SemaCXX/default-assignment-operator.cpp17
-rw-r--r--test/SemaCXX/empty-class-layout.cpp18
-rw-r--r--test/SemaCXX/enum.cpp10
-rw-r--r--test/SemaCXX/flexible-array-test.cpp45
-rw-r--r--test/SemaCXX/i-c-e-cxx.cpp2
-rw-r--r--test/SemaCXX/implicit-virtual-member-functions.cpp4
-rw-r--r--test/SemaCXX/invalid-instantiated-field-decl.cpp35
-rw-r--r--test/SemaCXX/member-pointer.cpp17
-rw-r--r--test/SemaCXX/namespace-alias.cpp20
-rw-r--r--test/SemaCXX/nested-name-spec.cpp16
-rw-r--r--test/SemaCXX/new-delete.cpp15
-rw-r--r--test/SemaCXX/offsetof.cpp2
-rw-r--r--test/SemaCXX/overload-call.cpp30
-rw-r--r--test/SemaCXX/references.cpp15
-rw-r--r--test/SemaCXX/return-noreturn.cpp17
-rw-r--r--test/SemaCXX/scope-check.cpp123
-rw-r--r--test/SemaCXX/switch.cpp19
-rw-r--r--test/SemaCXX/vararg-non-pod.cpp10
-rw-r--r--test/SemaCXX/vector.cpp188
-rw-r--r--test/SemaCXX/virtual-member-functions-key-function.cpp10
-rw-r--r--test/SemaCXX/warn-missing-noreturn.cpp14
-rw-r--r--test/SemaCXX/warn-reorder-ctor-initialization.cpp10
-rw-r--r--test/SemaCXX/warn-weak-vtables.cpp10
33 files changed, 1012 insertions, 38 deletions
diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp
index f02282d..dd64d6a 100644
--- a/test/SemaCXX/alignof-sizeof-reference.cpp
+++ b/test/SemaCXX/alignof-sizeof-reference.cpp
@@ -7,3 +7,9 @@ void test() {
static_assert(alignof(r) == 1, "bad alignment");
static_assert(sizeof(r) == 1, "bad size");
}
+
+void f();
+void f(int);
+void g() {
+ sizeof(&f); // expected-error{{invalid application of 'sizeof' to an overloaded function}}
+}
diff --git a/test/SemaCXX/anonymous-union.cpp b/test/SemaCXX/anonymous-union.cpp
index 5c34e01..5f84bcc 100644
--- a/test/SemaCXX/anonymous-union.cpp
+++ b/test/SemaCXX/anonymous-union.cpp
@@ -121,3 +121,37 @@ typedef struct _s {
int Foo;
};
} s, *ps;
+
+// <rdar://problem/7987650>
+namespace test4 {
+ class A {
+ struct {
+ int s0; // expected-note {{declared private here}}
+ double s1; // expected-note {{declared private here}}
+ union {
+ int su0; // expected-note {{declared private here}}
+ double su1; // expected-note {{declared private here}}
+ };
+ };
+ union {
+ int u0; // expected-note {{declared private here}}
+ double u1; // expected-note {{declared private here}}
+ struct {
+ int us0; // expected-note {{declared private here}}
+ double us1; // expected-note {{declared private here}}
+ };
+ };
+ };
+
+ void test() {
+ A a;
+ (void) a.s0; // expected-error {{private member}}
+ (void) a.s1; // expected-error {{private member}}
+ (void) a.su0; // expected-error {{private member}}
+ (void) a.su1; // expected-error {{private member}}
+ (void) a.u0; // expected-error {{private member}}
+ (void) a.u1; // expected-error {{private member}}
+ (void) a.us0; // expected-error {{private member}}
+ (void) a.us1; // expected-error {{private member}}
+ }
+}
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
index d5662d3..2164f9d 100644
--- a/test/SemaCXX/attr-deprecated.cpp
+++ b/test/SemaCXX/attr-deprecated.cpp
@@ -64,3 +64,129 @@ void D::f() { }
void f(D* d) {
d->f();
}
+
+
+// Overloaded namespace members.
+namespace test1 {
+ void foo(int) __attribute__((deprecated));
+ void test1() { foo(10); } // expected-warning {{deprecated}}
+ void foo(short) __attribute__((deprecated));
+ void test2(short s) { foo(s); } // expected-warning {{deprecated}}
+ void foo(long);
+ void test3(long l) { foo(l); }
+ struct A {
+ friend void foo(A*) __attribute__((deprecated));
+ };
+ void test4(A *a) { foo(a); } // expected-warning {{deprecated}}
+
+ namespace ns {
+ struct Foo {};
+ void foo(const Foo &f) __attribute__((deprecated));
+ }
+ void test5() {
+ foo(ns::Foo()); // expected-warning {{deprecated}}
+ }
+}
+
+// Overloaded class members.
+namespace test2 {
+ struct A {
+ void foo(int) __attribute__((deprecated));
+ void foo(long);
+ static void bar(int) __attribute__((deprecated));
+ static void bar(long);
+
+ void test2(int i, long l);
+ };
+ void test1(int i, long l) {
+ A a;
+ a.foo(i); // expected-warning {{deprecated}}
+ a.foo(l);
+ a.bar(i); // expected-warning {{deprecated}}
+ a.bar(l);
+ A::bar(i); // expected-warning {{deprecated}}
+ A::bar(l);
+ }
+
+ void A::test2(int i, long l) {
+ foo(i); // expected-warning {{deprecated}}
+ foo(l);
+ bar(i); // expected-warning {{deprecated}}
+ bar(l);
+ }
+}
+
+// Overloaded operators.
+namespace test3 {
+ struct A {
+ void operator*(const A &);
+ void operator*(int) __attribute__((deprecated));
+ void operator-(const A &) const;
+ };
+ void operator+(const A &, const A &);
+ void operator+(const A &, int) __attribute__((deprecated));
+ void operator-(const A &, int) __attribute__((deprecated));
+
+ void test() {
+ A a, b;
+ a + b;
+ a + 1; // expected-warning {{deprecated}}
+ a - b;
+ a - 1; // expected-warning {{deprecated}}
+ a * b;
+ a * 1; // expected-warning {{deprecated}}
+ }
+}
+
+// Overloaded operator call.
+namespace test4 {
+ struct A {
+ typedef void (*intfn)(int);
+ typedef void (*unintfn)(unsigned);
+ operator intfn() __attribute__((deprecated));
+ operator unintfn();
+ void operator ()(A &) __attribute__((deprecated));
+ void operator ()(const A &);
+ };
+
+ void test() {
+ A a;
+ a(1); // expected-warning {{deprecated}}
+ a(1U);
+
+ A &b = a;
+ const A &c = a;
+ a(b); // expected-warning {{deprecated}}
+ a(c);
+ }
+}
+
+namespace test5 {
+ struct A {
+ operator int() __attribute__((deprecated));
+ operator long();
+ };
+ void test1(A a) {
+ int i = a; // expected-warning {{deprecated}}
+ long l = a;
+ }
+
+ void foo(int);
+ void foo(void*);
+ void bar(long);
+ void bar(void*);
+ void test2(A a) {
+ foo(a); // expected-warning {{deprecated}}
+ bar(a);
+ }
+
+ struct B {
+ int myInt;
+ long myLong;
+
+ B(A &a) :
+ myInt(a), // expected-warning {{deprecated}}
+ myLong(a)
+ {}
+ };
+}
diff --git a/test/SemaCXX/blocks.cpp b/test/SemaCXX/blocks.cpp
index 9429543..baa79e7 100644
--- a/test/SemaCXX/blocks.cpp
+++ b/test/SemaCXX/blocks.cpp
@@ -9,3 +9,35 @@ void tovoid_test(int (^f)(int, int)) {
void reference_lvalue_test(int& (^f)()) {
f() = 10;
}
+
+// PR 7165
+namespace test1 {
+ void g(void (^)());
+ struct Foo {
+ void foo();
+ void test() {
+ (void) ^{ foo(); };
+ }
+ };
+}
+
+namespace test2 {
+ int repeat(int value, int (^block)(int), unsigned n) {
+ while (n--) value = block(value);
+ return value;
+ }
+
+ class Power {
+ int base;
+
+ public:
+ Power(int base) : base(base) {}
+ int calculate(unsigned n) {
+ return repeat(1, ^(int v) { return v * base; }, n);
+ }
+ };
+
+ int test() {
+ return Power(2).calculate(10);
+ }
+}
diff --git a/test/SemaCXX/c99-variable-length-array.cpp b/test/SemaCXX/c99-variable-length-array.cpp
new file mode 100644
index 0000000..7dc912a
--- /dev/null
+++ b/test/SemaCXX/c99-variable-length-array.cpp
@@ -0,0 +1,116 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wvla %s
+struct NonPOD {
+ NonPOD();
+};
+
+struct NonPOD2 {
+ NonPOD np;
+};
+
+struct POD {
+ int x;
+ int y;
+};
+
+// We allow VLAs of POD types, only.
+void vla(int N) {
+ int array1[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ POD array2[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ NonPOD array3[N]; // expected-error{{variable length array of non-POD element type 'NonPOD'}}
+ NonPOD2 array4[N][3]; // expected-error{{variable length array of non-POD element type 'NonPOD2'}}
+}
+
+/// Warn about VLAs in templates.
+template<typename T>
+void vla_in_template(int N, T t) {
+ int array1[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+}
+
+struct HasConstantValue {
+ static const unsigned int value = 2;
+};
+
+struct HasNonConstantValue {
+ static unsigned int value;
+};
+
+template<typename T>
+void vla_in_template(T t) {
+ int array2[T::value]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+}
+
+template void vla_in_template<HasConstantValue>(HasConstantValue);
+template void vla_in_template<HasNonConstantValue>(HasNonConstantValue); // expected-note{{instantiation of}}
+
+template<typename T> struct X0 { };
+
+// Cannot use any variably-modified type with a template parameter or
+// argument.
+void inst_with_vla(int N) {
+ int array[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ X0<__typeof__(array)> x0a; // expected-error{{variably modified type 'typeof (array)' (aka 'int [N]') cannot be used as a template argument}}
+}
+
+template<typename T>
+struct X1 {
+ template<int (&Array)[T::value]> // expected-error{{non-type template parameter of variably modified type 'int (&)[HasNonConstantValue::value]'}} \
+ // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ struct Inner {
+
+ };
+};
+
+X1<HasConstantValue> x1a;
+X1<HasNonConstantValue> x1b; // expected-note{{in instantiation of}}
+
+// Template argument deduction does not allow deducing a size from a VLA.
+template<typename T, unsigned N>
+void accept_array(T (&array)[N]); // expected-note{{candidate template ignored: failed template argument deduction}}
+
+void test_accept_array(int N) {
+ int array[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ accept_array(array); // expected-error{{no matching function for call to 'accept_array'}}
+}
+
+// Variably-modified types cannot be used in local classes.
+void local_classes(int N) {
+ struct X {
+ int size;
+ int array[N]; // expected-error{{fields must have a constant size: 'variable length array in structure' extension will never be supported}} \
+ // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ };
+}
+
+namespace PR7206 {
+ void f(int x) {
+ struct edge_info {
+ float left;
+ float right;
+ };
+ struct edge_info edgeInfo[x]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ }
+}
+
+namespace rdar8020206 {
+ template<typename T>
+ void f(int i) {
+ const unsigned value = i;
+ int array[value * i]; // expected-warning 2{{variable length arrays are a C99 feature, accepted as an extension}}
+ }
+
+ template void f<int>(int); // expected-note{{instantiation of}}
+}
+
+namespace rdar8021385 {
+ typedef int my_int;
+ struct A { typedef int my_int; };
+ template<typename T>
+ struct B {
+ typedef typename T::my_int my_int;
+ void f0() {
+ int M = 4;
+ my_int a[M]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ }
+ };
+ B<A> a;
+}
diff --git a/test/SemaCXX/c99.cpp b/test/SemaCXX/c99.cpp
index f4c3639..b0bd45d 100644
--- a/test/SemaCXX/c99.cpp
+++ b/test/SemaCXX/c99.cpp
@@ -1,8 +1,3 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-void f0(int i) {
- char array[i]; // expected-error{{variable length arrays}}
-}
-
void f1(int i[static 5]) { // expected-error{{C99}}
}
diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp
index 7eea67a..b5cecbc 100644
--- a/test/SemaCXX/class.cpp
+++ b/test/SemaCXX/class.cpp
@@ -136,3 +136,26 @@ namespace pr6629 {
};
};
}
+
+namespace PR7153 {
+ class EnclosingClass {
+ public:
+ struct A { } mutable *member;
+ };
+
+ void f(const EnclosingClass &ec) {
+ ec.member = 0;
+ }
+}
+
+namespace PR7196 {
+ struct A {
+ int a;
+
+ void f() {
+ char i[sizeof(a)];
+ enum { x = sizeof(i) };
+ enum { y = sizeof(a) };
+ }
+ };
+}
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp
index cd243e3..4790347 100644
--- a/test/SemaCXX/compare.cpp
+++ b/test/SemaCXX/compare.cpp
@@ -19,8 +19,8 @@ int test0(long a, unsigned long b) {
((signed char) a == b) + // expected-warning {{comparison of integers of different signs}}
((long) a == (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
((int) a == (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
- ((short) a == (unsigned short) b) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a == (unsigned char) b) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a == (unsigned short) b) +
+ ((signed char) a == (unsigned char) b) +
(a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
(a < (unsigned int) b) +
(a < (unsigned short) b) +
@@ -31,8 +31,8 @@ int test0(long a, unsigned long b) {
((signed char) a < b) + // expected-warning {{comparison of integers of different signs}}
((long) a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) b) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) b) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) b) +
+ ((signed char) a < (unsigned char) b) +
// (A,b)
(A == (unsigned long) b) +
@@ -83,8 +83,8 @@ int test0(long a, unsigned long b) {
((signed char) a < B) +
((long) a < (unsigned long) B) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) B) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) B) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) B) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) B) +
+ ((signed char) a < (unsigned char) B) +
// (C,b)
(C == (unsigned long) b) +
@@ -135,8 +135,8 @@ int test0(long a, unsigned long b) {
((signed char) a < C) +
((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) C) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) C) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) C) +
+ ((signed char) a < (unsigned char) C) +
// (0x80000,b)
(0x80000 == (unsigned long) b) +
@@ -187,8 +187,8 @@ int test0(long a, unsigned long b) {
((signed char) a < 0x80000) +
((long) a < (unsigned long) 0x80000) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) 0x80000) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) 0x80000) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) 0x80000) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) 0x80000) +
+ ((signed char) a < (unsigned char) 0x80000) +
10
;
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index a812a59..a09ff2b 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -238,3 +238,40 @@ namespace PR6757 {
(void)(true ? Bar() : Foo3()); // expected-error{{no viable constructor copying temporary}}
}
}
+
+// Reduced from selfhost.
+namespace test1 {
+ struct A {
+ enum Foo {
+ fa, fb, fc, fd, fe, ff
+ };
+
+ Foo x();
+ };
+
+ void foo(int);
+
+ void test(A *a) {
+ foo(a ? a->x() : 0);
+ }
+}
+
+namespace rdar7998817 {
+ class X {
+ X(X&); // expected-note{{declared private here}}
+
+ struct ref { };
+
+ public:
+ X();
+ X(ref);
+
+ operator ref();
+ };
+
+ void f(bool B) {
+ X x;
+ (void)(B? x // expected-error{{calling a private constructor of class 'rdar7998817::X'}}
+ : X());
+ }
+}
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp
index a17dd58..1341036 100644
--- a/test/SemaCXX/constant-expression.cpp
+++ b/test/SemaCXX/constant-expression.cpp
@@ -57,8 +57,8 @@ template <int itval, Enum etval> struct C {
i10 = sizeof(Struct),
i11 = true? 1 + cval * Struct::sval ^ itval / (int)1.5 - sizeof(Struct) : 0
;
- void f() {
- switch(0) {
+ void f(int cond) {
+ switch(cond) {
case 0 + 1:
case 100 + eval:
case 200 + cval:
diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp
index dee6d13..668c600 100644
--- a/test/SemaCXX/default-assignment-operator.cpp
+++ b/test/SemaCXX/default-assignment-operator.cpp
@@ -1,15 +1,14 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
class Base { // expected-error {{cannot define the implicit default assignment operator for 'Base', because non-static reference member 'ref' can't use default assignment operator}} \
- // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} \
- // expected-note {{synthesized method is first required here}}
+ // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}}
int &ref; // expected-note {{declared here}} \
// expected-note{{reference member 'ref' will never be initialized}}
};
class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'X', because non-static const member 'cint' can't use default assignment operator}} \
- // expected-note {{synthesized method is first required here}}
-public:
+// expected-note{{assignment operator for 'Base' first required here}}
+public:
X();
const int cint; // expected-note {{declared here}}
};
@@ -29,7 +28,7 @@ Z z2;
// Test1
void f(X x, const X cx) {
- x = cx;
+ x = cx; // expected-note{{assignment operator for 'X' first required here}}
x = cx;
z1 = z2;
}
@@ -74,8 +73,7 @@ void i() {
// Test5
-class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}} \
- // expected-note {{synthesized method is first required here}}
+class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}}
public:
const int a; // expected-note{{declared here}}
@@ -86,7 +84,7 @@ public:
E1 e1, e2;
void j() {
- e1 = e2;
+ e1 = e2; // expected-note{{assignment operator for 'E1' first required here}}
}
namespace ProtectedCheck {
@@ -103,7 +101,8 @@ namespace ProtectedCheck {
X x;
};
- void f(Z z) { z = z; } //
+ void f(Z z) { z = z; } // expected-note{{implicit default copy assignment operator}}
+
}
namespace MultiplePaths {
diff --git a/test/SemaCXX/empty-class-layout.cpp b/test/SemaCXX/empty-class-layout.cpp
index c3dc733..27f5040 100644
--- a/test/SemaCXX/empty-class-layout.cpp
+++ b/test/SemaCXX/empty-class-layout.cpp
@@ -2,6 +2,8 @@
#define SA(n, p) int a##n[(p) ? 1 : -1]
+namespace Test0 {
+
struct A { int a; };
SA(0, sizeof(A) == 4);
@@ -66,3 +68,19 @@ SA(11, sizeof(S7) == 8);
struct S8 : Empty, A {
};
SA(12, sizeof(S8) == 4);
+
+}
+
+namespace Test1 {
+
+// Test that we don't try to place both A subobjects at offset 0.
+struct A { };
+class B { virtual void f(); };
+class C : A, virtual B { };
+struct D : virtual C { };
+struct E : virtual A { };
+class F : D, E { };
+
+SA(0, sizeof(F) == 24);
+
+}
diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp
index dc4a506..bfb5784 100644
--- a/test/SemaCXX/enum.cpp
+++ b/test/SemaCXX/enum.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++98 -verify -triple x86_64-apple-darwin %s
-
enum E {
Val1,
Val2
@@ -71,3 +70,12 @@ namespace PR6061 {
namespace Conditional {
enum a { A }; a x(const enum a x) { return 1?x:A; }
}
+
+namespace PR7051 {
+ enum E { e0 };
+ void f() {
+ E e;
+ e = 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}}
+ e |= 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}}
+ }
+}
diff --git a/test/SemaCXX/flexible-array-test.cpp b/test/SemaCXX/flexible-array-test.cpp
new file mode 100644
index 0000000..02e3f83
--- /dev/null
+++ b/test/SemaCXX/flexible-array-test.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// pr7029
+
+template <class Key, class T> struct QMap
+{
+ void insert(const Key &, const T &);
+ T v;
+};
+
+
+template <class Key, class T>
+void QMap<Key, T>::insert(const Key &, const T &avalue)
+{
+ v = avalue;
+}
+
+
+struct inotify_event
+{
+ int wd;
+
+ // clang doesn't like '[]':
+ // cannot initialize a parameter of type 'void *' with an rvalue of type 'char (*)[]'
+ char name [];
+};
+
+
+void foo()
+{
+ inotify_event event;
+ inotify_event* ptr = &event;
+ inotify_event event1 = *ptr;
+ *ptr = event;
+ QMap<int, inotify_event> eventForId;
+ eventForId.insert(ptr->wd, *ptr);
+}
+
+struct S {
+ virtual void foo();
+};
+
+struct X {
+ int blah;
+ S strings[]; // expected-error {{flexible array member 'strings' of non-POD element type 'S []'}}
+};
diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp
index e8275d4..9672a42 100644
--- a/test/SemaCXX/i-c-e-cxx.cpp
+++ b/test/SemaCXX/i-c-e-cxx.cpp
@@ -17,7 +17,7 @@ void f() {
int a() {
const int t=t; // expected-note {{subexpression not valid}}
- switch(1) {
+ switch(1) { // expected-warning {{no case matching constant switch condition '1'}}
case t:; // expected-error {{not an integer constant expression}}
}
}
diff --git a/test/SemaCXX/implicit-virtual-member-functions.cpp b/test/SemaCXX/implicit-virtual-member-functions.cpp
index cb24501..f6082e5 100644
--- a/test/SemaCXX/implicit-virtual-member-functions.cpp
+++ b/test/SemaCXX/implicit-virtual-member-functions.cpp
@@ -21,9 +21,9 @@ C::C() { } // expected-note {{implicit default destructor for 'C' first require
struct D : A { // expected-error {{no suitable member 'operator delete' in 'D'}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-}; // expected-note {{implicit default destructor for 'D' first required here}}
+};
void f() {
- new D;
+ new D; // expected-note {{implicit default destructor for 'D' first required here}}
}
diff --git a/test/SemaCXX/invalid-instantiated-field-decl.cpp b/test/SemaCXX/invalid-instantiated-field-decl.cpp
new file mode 100644
index 0000000..8b26489
--- /dev/null
+++ b/test/SemaCXX/invalid-instantiated-field-decl.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template <typename T>
+class SmallVectorImpl {
+public:
+ explicit SmallVectorImpl(unsigned N) {
+ }
+
+ ~SmallVectorImpl() { }
+
+};
+
+template <typename T, unsigned N>
+class SmallVector : public SmallVectorImpl<T> {
+ typedef typename SmallVectorImpl<T>::U U; // expected-error {{no type named 'U' in 'SmallVectorImpl<CallSite>'}}
+ enum {
+
+ MinUs = (static_cast<unsigned int>(sizeof(T))*N + // expected-error {{invalid application of 'sizeof' to an incomplete type 'CallSite'}}
+ static_cast<unsigned int>(sizeof(U)) - 1) /
+ static_cast<unsigned int>(sizeof(U)),
+ NumInlineEltsElts = MinUs
+ };
+ U InlineElts[NumInlineEltsElts];
+public:
+ SmallVector() : SmallVectorImpl<T>(NumInlineEltsElts) {
+ }
+
+};
+
+class CallSite; // expected-note {{forward declaration of 'CallSite'}}
+class InlineFunctionInfo {
+public:
+ explicit InlineFunctionInfo() {}
+ SmallVector<CallSite, 2> DevirtualizedCalls; // expected-note {{in instantiation of template class 'SmallVector<CallSite, 2>' requested}}
+};
diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp
index be25cbd..9d5cd2f 100644
--- a/test/SemaCXX/member-pointer.cpp
+++ b/test/SemaCXX/member-pointer.cpp
@@ -157,3 +157,20 @@ namespace pr6783 {
return object->*p2m; // expected-error {{left hand operand to ->*}}
}
}
+
+namespace PR7176 {
+ namespace base
+ {
+ struct Process
+ { };
+ struct Continuous : Process
+ {
+ bool cond();
+ };
+ }
+
+ typedef bool( base::Process::*Condition )();
+
+ void m()
+ { (void)(Condition) &base::Continuous::cond; }
+}
diff --git a/test/SemaCXX/namespace-alias.cpp b/test/SemaCXX/namespace-alias.cpp
index 1c3da3c..52cae2e 100644
--- a/test/SemaCXX/namespace-alias.cpp
+++ b/test/SemaCXX/namespace-alias.cpp
@@ -84,6 +84,26 @@ namespace K {
}
}
+namespace {
+ class C1;
+}
+namespace {
+ class C1;
+}
+C1 *pc1 = 0;
+
+namespace N {
+ namespace {
+ class C2;
+ }
+}
+namespace N {
+ namespace {
+ class C2;
+ }
+}
+N::C2 *pc2 = 0;
+
// PR6341
namespace A = N;
namespace N { }
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 59a8e8c..0dc1097 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -228,3 +228,19 @@ namespace test3 {
A::execute(path); // expected-error {{incomplete type 'test3::A' named in nested name specifier}}
}
}
+
+namespace PR7133 {
+ namespace A {
+ class Foo;
+ }
+
+ namespace A {
+ namespace B {
+ bool foo(Foo &);
+ }
+ }
+
+ bool A::B::foo(Foo &) {
+ return false;
+ }
+}
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 763ed2c..3f1da02 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -24,6 +24,8 @@ void* operator new(size_t, int*); // expected-note 3 {{candidate}}
void* operator new(size_t, float*); // expected-note 3 {{candidate}}
void* operator new(size_t, S); // expected-note 2 {{candidate}}
+struct foo { };
+
void good_news()
{
int *pi = new int;
@@ -43,6 +45,14 @@ void good_news()
pi = new (S(1.0f, 2)) int;
(void)new int[true];
+
+ // PR7147
+ typedef int a[2];
+ foo* f1 = new foo;
+ foo* f2 = new foo[2];
+ typedef foo x[2];
+ typedef foo y[2][2];
+ x* f3 = new y;
}
struct abstract {
@@ -93,7 +103,7 @@ void bad_deletes()
delete 0; // expected-error {{cannot delete expression of type 'int'}}
delete [0] (int*)0; // expected-error {{expected ']'}} \
// expected-note {{to match this '['}}
- delete (void*)0; // expected-error {{cannot delete expression}}
+ delete (void*)0; // expected-warning {{cannot delete expression with pointer-to-'void' type 'void *'}}
delete (T*)0; // expected-warning {{deleting pointer to incomplete type}}
::S::delete (int*)0; // expected-error {{expected unqualified-id}}
}
@@ -235,6 +245,9 @@ namespace Test1 {
void f() {
(void)new int[10](1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
+
+ typedef int T[10];
+ (void)new T(1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
}
template<typename T>
diff --git a/test/SemaCXX/offsetof.cpp b/test/SemaCXX/offsetof.cpp
index 47c3f22..639d7fa 100644
--- a/test/SemaCXX/offsetof.cpp
+++ b/test/SemaCXX/offsetof.cpp
@@ -26,7 +26,7 @@ struct HasArray {
// Constant and non-constant offsetof expressions
void test_ice(int i) {
int array0[__builtin_offsetof(HasArray, array[5])];
- int array1[__builtin_offsetof(HasArray, array[i])]; // expected-error{{variable length arrays are not permitted in C++}}
+ int array1[__builtin_offsetof(HasArray, array[i])];
}
// Bitfields
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 79c74ce..29133c7 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -430,3 +430,33 @@ namespace PR6177 {
void g() { f(""); } // expected-error{{volatile lvalue reference to type 'bool const volatile' cannot bind to a value of unrelated type 'char const [1]'}}
}
+
+namespace PR7095 {
+ struct X { };
+
+ struct Y {
+ operator const X*();
+
+ private:
+ operator X*();
+ };
+
+ void f(const X *);
+ void g(Y y) { f(y); }
+}
+
+namespace PR7224 {
+ class A {};
+ class B : public A {};
+
+ int &foo(A *const d);
+ float &foo(const A *const d);
+
+ void bar()
+ {
+ B *const d = 0;
+ B const *const d2 = 0;
+ int &ir = foo(d);
+ float &fr = foo(d2);
+ }
+}
diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp
index e40ea01..a7aafe4 100644
--- a/test/SemaCXX/references.cpp
+++ b/test/SemaCXX/references.cpp
@@ -115,3 +115,18 @@ void test10() {
int &c = ev.x; // expected-error{{non-const reference cannot bind to vector element}}
const int &d = ev.x;
}
+
+namespace PR7149 {
+ template<typename T> struct X0
+ {
+ T& first;
+ X0(T& p1) : first(p1) { }
+ };
+
+
+ void f()
+ {
+ int p1[1];
+ X0< const int[1]> c(p1);
+ }
+}
diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp
new file mode 100644
index 0000000..9242d12
--- /dev/null
+++ b/test/SemaCXX/return-noreturn.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn -Wno-unreachable-code
+
+// A destructor may be marked noreturn and should still influence the CFG.
+namespace PR6884 {
+ struct abort_struct {
+ abort_struct() {} // Make this non-POD so the destructor is invoked.
+ ~abort_struct() __attribute__((noreturn));
+ };
+
+ int f() {
+ abort_struct();
+ }
+
+ int f2() {
+ abort_struct s;
+ } // expected-warning{{control reaches end of non-void function}}
+}
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp
new file mode 100644
index 0000000..cef64f6
--- /dev/null
+++ b/test/SemaCXX/scope-check.cpp
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-unreachable-code
+
+namespace test0 {
+ struct D { ~D(); };
+
+ int f(bool b) {
+ if (b) {
+ D d;
+ goto end;
+ }
+
+ end:
+ return 1;
+ }
+}
+
+namespace test1 {
+ struct C { C(); };
+
+ int f(bool b) {
+ if (b)
+ goto foo; // expected-error {{illegal goto into protected scope}}
+ C c; // expected-note {{jump bypasses variable initialization}}
+ foo:
+ return 1;
+ }
+}
+
+namespace test2 {
+ struct C { C(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+
+ C c;
+ goto *ip;
+ lbl1:
+ return 0;
+ lbl2:
+ return 1;
+ }
+}
+
+namespace test3 {
+ struct C { C(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+
+ goto *ip;
+ lbl1: {
+ C c;
+ return 0;
+ }
+ lbl2:
+ return 1;
+ }
+}
+
+namespace test4 {
+ struct C { C(); };
+ struct D { ~D(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+
+ C c0;
+
+ goto *ip; // expected-warning {{indirect goto might cross protected scopes}}
+ C c1; // expected-note {{jump bypasses variable initialization}}
+ lbl1: // expected-note {{possible target of indirect goto}}
+ return 0;
+ lbl2:
+ return 1;
+ }
+}
+
+namespace test5 {
+ struct C { C(); };
+ struct D { ~D(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+ C c0;
+
+ goto *ip;
+ lbl1: // expected-note {{possible target of indirect goto}}
+ return 0;
+ lbl2:
+ if (ip[1]) {
+ D d; // expected-note {{jump exits scope of variable with non-trivial destructor}}
+ ip += 2;
+ goto *ip; // expected-warning {{indirect goto might cross protected scopes}}
+ }
+ return 1;
+ }
+}
+
+namespace test6 {
+ struct C { C(); };
+
+ unsigned f(unsigned s0, unsigned s1, void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2, &&lbl3, &&lbl4 };
+ C c0;
+
+ goto *ip;
+ lbl1:
+ s0++;
+ goto *++ip;
+ lbl2:
+ s0 -= s1;
+ goto *++ip;
+ lbl3: {
+ unsigned tmp = s0;
+ s0 = s1;
+ s1 = tmp;
+ goto *++ip;
+ }
+ lbl4:
+ return s0;
+ }
+}
+
diff --git a/test/SemaCXX/switch.cpp b/test/SemaCXX/switch.cpp
index c256960..fc13630 100644
--- a/test/SemaCXX/switch.cpp
+++ b/test/SemaCXX/switch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum %s
void test() {
bool x = true;
@@ -40,3 +40,20 @@ void x3(C &c) {
switch (c) { // expected-error{{incomplete class type}}
}
}
+
+namespace test3 {
+ enum En { A, B, C };
+ template <En how> void foo() {
+ int x = 0, y = 5;
+
+ switch (how) { //expected-warning {{no case matching constant switch condition '2'}}
+ case A: x *= y; break;
+ case B: x += y; break;
+ // No case for C, but it's okay because we have a constant condition.
+ }
+ }
+
+ template void foo<A>();
+ template void foo<B>();
+ template void foo<C>(); //expected-note {{in instantiation}}
+}
diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp
index d31f1f7..55ec941 100644
--- a/test/SemaCXX/vararg-non-pod.cpp
+++ b/test/SemaCXX/vararg-non-pod.cpp
@@ -88,3 +88,13 @@ void test_typeid(Base &base) {
(void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'Base' through variadic function; call will abort at runtime}}
(void)typeid(eat_base(base)); // okay
}
+
+
+// rdar://7985267 - Shouldn't warn, doesn't actually use __builtin_va_start is
+// magic.
+
+void t6(Foo somearg, ... ) {
+ __builtin_va_list list;
+ __builtin_va_start(list, somearg);
+}
+
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
new file mode 100644
index 0000000..b548865
--- /dev/null
+++ b/test/SemaCXX/vector.cpp
@@ -0,0 +1,188 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+typedef char char16 __attribute__ ((__vector_size__ (16)));
+typedef long long longlong16 __attribute__ ((__vector_size__ (16)));
+typedef char char16_e __attribute__ ((__ext_vector_type__ (16)));
+typedef long long longlong16_e __attribute__ ((__ext_vector_type__ (2)));
+
+// Test overloading and function calls with vector types.
+void f0(char16);
+
+void f0_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
+ f0(c16);
+ f0(ll16);
+ f0(c16e);
+ f0(ll16e);
+}
+
+int &f1(char16); // expected-note 2{{candidate function}}
+float &f1(longlong16); // expected-note 2{{candidate function}}
+
+void f1_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
+ int &ir1 = f1(c16);
+ float &fr1 = f1(ll16);
+ f1(c16e); // expected-error{{call to 'f1' is ambiguous}}
+ f1(ll16e); // expected-error{{call to 'f1' is ambiguous}}
+}
+
+void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' to 'char16_e' for 1st argument}} \
+ // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' for 1st argument}}
+
+void f2_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
+ f2(c16);
+ f2(ll16);
+ f2(c16e);
+ f2(ll16e); // expected-error{{no matching function}}
+ f2('a');
+ f2(17);
+}
+
+// Test the conditional operator with vector types.
+void conditional(bool Cond, char16 c16, longlong16 ll16, char16_e c16e,
+ longlong16_e ll16e) {
+ // Conditional operators with the same type.
+ __typeof__(Cond? c16 : c16) *c16p1 = &c16;
+ __typeof__(Cond? ll16 : ll16) *ll16p1 = &ll16;
+ __typeof__(Cond? c16e : c16e) *c16ep1 = &c16e;
+ __typeof__(Cond? ll16e : ll16e) *ll16ep1 = &ll16e;
+
+ // Conditional operators with similar types.
+ __typeof__(Cond? c16 : c16e) *c16ep2 = &c16e;
+ __typeof__(Cond? c16e : c16) *c16ep3 = &c16e;
+ __typeof__(Cond? ll16 : ll16e) *ll16ep2 = &ll16e;
+ __typeof__(Cond? ll16e : ll16) *ll16ep3 = &ll16e;
+
+ // Conditional operators with incompatible types.
+ (void)(Cond? c16 : ll16); // expected-error{{can't convert between vector values}}
+ (void)(Cond? ll16e : c16e); // expected-error{{can't convert between vector values}}
+ (void)(Cond? ll16e : c16); // expected-error{{can't convert between vector values}}
+}
+
+// Test C++ cast'ing of vector types.
+void casts(longlong16 ll16, longlong16_e ll16e) {
+ // C-style casts.
+ (void)(char16)ll16;
+ (void)(char16_e)ll16;
+ (void)(longlong16)ll16;
+ (void)(longlong16_e)ll16;
+ (void)(char16)ll16e;
+ (void)(char16_e)ll16e;
+ (void)(longlong16)ll16e;
+ (void)(longlong16_e)ll16e;
+
+ // Function-style casts.
+ (void)char16(ll16);
+ (void)char16_e(ll16);
+ (void)longlong16(ll16);
+ (void)longlong16_e(ll16);
+ (void)char16(ll16e);
+ (void)char16_e(ll16e);
+ (void)longlong16(ll16e);
+ (void)longlong16_e(ll16e);
+
+ // static_cast
+ (void)static_cast<char16>(ll16);
+ (void)static_cast<char16_e>(ll16);
+ (void)static_cast<longlong16>(ll16);
+ (void)static_cast<longlong16_e>(ll16);
+ (void)static_cast<char16>(ll16e);
+ (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' to 'char16_e' is not allowed}}
+ (void)static_cast<longlong16>(ll16e);
+ (void)static_cast<longlong16_e>(ll16e);
+
+ // reinterpret_cast
+ (void)reinterpret_cast<char16>(ll16);
+ (void)reinterpret_cast<char16_e>(ll16);
+ (void)reinterpret_cast<longlong16>(ll16);
+ (void)reinterpret_cast<longlong16_e>(ll16);
+ (void)reinterpret_cast<char16>(ll16e);
+ (void)reinterpret_cast<char16_e>(ll16e);
+ (void)reinterpret_cast<longlong16>(ll16e);
+ (void)reinterpret_cast<longlong16_e>(ll16e);
+}
+
+template<typename T>
+struct convertible_to { // expected-note 3 {{candidate function (the implicit copy assignment operator)}}
+ operator T() const;
+};
+
+void test_implicit_conversions(bool Cond, char16 c16, longlong16 ll16,
+ char16_e c16e, longlong16_e ll16e,
+ convertible_to<char16> to_c16,
+ convertible_to<longlong16> to_ll16,
+ convertible_to<char16_e> to_c16e,
+ convertible_to<longlong16_e> to_ll16e,
+ convertible_to<char16&> rto_c16,
+ convertible_to<char16_e&> rto_c16e) {
+ f0(to_c16);
+ f0(to_ll16);
+ f0(to_c16e);
+ f0(to_ll16e);
+ f2(to_c16);
+ f2(to_ll16);
+ f2(to_c16e);
+ f2(to_ll16e); // expected-error{{no matching function}}
+
+ (void)(c16 == c16e);
+ (void)(c16 == to_c16);
+ (void)+to_c16;
+ (void)-to_c16;
+ (void)~to_c16;
+ (void)(to_c16 == to_c16e);
+ (void)(to_c16 != to_c16e);
+ (void)(to_c16 < to_c16e);
+ (void)(to_c16 <= to_c16e);
+ (void)(to_c16 > to_c16e);
+ (void)(to_c16 >= to_c16e);
+ (void)(to_c16 + to_c16);
+ (void)(to_c16 - to_c16);
+ (void)(to_c16 * to_c16);
+ (void)(to_c16 / to_c16);
+ (void)(rto_c16 = to_c16); // expected-error{{no viable overloaded '='}}
+ (void)(rto_c16 += to_c16);
+ (void)(rto_c16 -= to_c16);
+ (void)(rto_c16 *= to_c16);
+ (void)(rto_c16 /= to_c16);
+
+ (void)+to_c16e;
+ (void)-to_c16e;
+ (void)~to_c16e;
+ (void)(to_c16e == to_c16e);
+ (void)(to_c16e != to_c16e);
+ (void)(to_c16e < to_c16e);
+ (void)(to_c16e <= to_c16e);
+ (void)(to_c16e > to_c16e);
+ (void)(to_c16e >= to_c16e);
+ (void)(to_c16e + to_c16);
+ (void)(to_c16e - to_c16);
+ (void)(to_c16e * to_c16);
+ (void)(to_c16e / to_c16);
+ (void)(rto_c16e = to_c16); // expected-error{{no viable overloaded '='}}
+ (void)(rto_c16e += to_c16);
+ (void)(rto_c16e -= to_c16);
+ (void)(rto_c16e *= to_c16);
+ (void)(rto_c16e /= to_c16);
+
+ (void)+to_c16;
+ (void)-to_c16;
+ (void)~to_c16;
+ (void)(to_c16 == to_c16e);
+ (void)(to_c16 != to_c16e);
+ (void)(to_c16 < to_c16e);
+ (void)(to_c16 <= to_c16e);
+ (void)(to_c16 > to_c16e);
+ (void)(to_c16 >= to_c16e);
+ (void)(to_c16 + to_c16e);
+ (void)(to_c16 - to_c16e);
+ (void)(to_c16 * to_c16e);
+ (void)(to_c16 / to_c16e);
+ (void)(rto_c16 = c16e); // expected-error{{no viable overloaded '='}}
+ (void)(rto_c16 += to_c16e); // expected-error{{expression is not assignable}}
+ (void)(rto_c16 -= to_c16e); // expected-error{{expression is not assignable}}
+ (void)(rto_c16 *= to_c16e); // expected-error{{expression is not assignable}}
+ (void)(rto_c16 /= to_c16e); // expected-error{{expression is not assignable}}
+
+ (void)(Cond? to_c16 : to_c16e);
+ (void)(Cond? to_ll16e : to_ll16);
+ (void)(Cond? to_c16 : to_ll16); // expected-error{{can't convert between vector values of different size}}
+ (void)(Cond? to_c16e : to_ll16e); // expected-error{{can't convert between vector values of different size}}
+}
diff --git a/test/SemaCXX/virtual-member-functions-key-function.cpp b/test/SemaCXX/virtual-member-functions-key-function.cpp
index 97164d9..09a30b9 100644
--- a/test/SemaCXX/virtual-member-functions-key-function.cpp
+++ b/test/SemaCXX/virtual-member-functions-key-function.cpp
@@ -4,17 +4,17 @@ struct A {
};
struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}}
- B() { }
+ B() { } // expected-note {{implicit default destructor for 'B' first required here}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-}; // expected-note {{implicit default destructor for 'B' first required here}}
+};
struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-}; // expected-note {{implicit default destructor for 'C' first required here}}
+};
void f() {
- (void)new B;
- (void)new C;
+ (void)new B;
+ (void)new C; // expected-note {{implicit default destructor for 'C' first required here}}
}
// Make sure that the key-function computation is consistent when the
diff --git a/test/SemaCXX/warn-missing-noreturn.cpp b/test/SemaCXX/warn-missing-noreturn.cpp
index 8016c3d..f2f9b2e 100644
--- a/test/SemaCXX/warn-missing-noreturn.cpp
+++ b/test/SemaCXX/warn-missing-noreturn.cpp
@@ -36,3 +36,17 @@ namespace test1 {
while (condition()) {}
}
}
+
+
+// <rdar://problem/7880658> - This test case previously had a false "missing return"
+// warning.
+struct R7880658 {
+ R7880658 &operator++();
+ bool operator==(const R7880658 &) const;
+ bool operator!=(const R7880658 &) const;
+};
+
+void f_R7880658(R7880658 f, R7880658 l) { // no-warning
+ for (; f != l; ++f) {
+ }
+}
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
index 3ff01af..8c254e5 100644
--- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp
+++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
@@ -120,3 +120,13 @@ namespace test3 {
};
};
}
+
+namespace PR7179 {
+ struct X
+ {
+ struct Y
+ {
+ template <class T> Y(T x) : X(x) { }
+ };
+ };
+}
diff --git a/test/SemaCXX/warn-weak-vtables.cpp b/test/SemaCXX/warn-weak-vtables.cpp
index 39333c1..c0cfd74 100644
--- a/test/SemaCXX/warn-weak-vtables.cpp
+++ b/test/SemaCXX/warn-weak-vtables.cpp
@@ -18,4 +18,14 @@ void f() {
struct A {
virtual void f() { }
};
+
+ A *a;
+ a->f();
+}
+
+// Use the vtables
+void uses(A &a, B<int> &b, C &c) {
+ a.f();
+ b.f();
+ c.f();
}
OpenPOWER on IntegriCloud