diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/composite-pointer-type.cpp | 27 | ||||
-rw-r--r-- | test/SemaCXX/elaborated-type-specifier.cpp | 3 |
2 files changed, 28 insertions, 2 deletions
diff --git a/test/SemaCXX/composite-pointer-type.cpp b/test/SemaCXX/composite-pointer-type.cpp new file mode 100644 index 0000000000..b4a5c884f7 --- /dev/null +++ b/test/SemaCXX/composite-pointer-type.cpp @@ -0,0 +1,27 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +class Base { }; +class Derived1 : public Base { }; +class Derived2 : public Base { }; + +void f0(volatile Base *b, Derived1 *d1, const Derived2 *d2) { + if (b > d1) + return; + if (d1 <= b) + return; + if (b > d2) + return; + if (d1 >= d2) // expected-error{{comparison of distinct}} + return; +} + +void f1(volatile Base *b, Derived1 *d1, const Derived2 *d2) { + if (b == d1) + return; + if (d1 == b) + return; + if (b != d2) + return; + if (d1 == d2) // expected-error{{comparison of distinct}} + return; +} diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp index c7bf46a5b1..70478e0f32 100644 --- a/test/SemaCXX/elaborated-type-specifier.cpp +++ b/test/SemaCXX/elaborated-type-specifier.cpp @@ -38,10 +38,9 @@ void test_S5_scope() { S4 *s4; // expected-error{{use of undeclared identifier 'S4'}} } -// FIXME: the warning below should be an error! int test_funcparam_scope(struct S5 * s5) { struct S5 { int y; } *s5_2 = 0; - if (s5 == s5_2) return 1; // expected-warning {{comparison of distinct pointer types ('struct S5 *' and 'struct S5 *')}} + if (s5 == s5_2) return 1; // expected-error {{comparison of distinct pointer types ('struct S5 *' and 'struct S5 *')}} return 0; } |