diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-04 06:07:12 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-04 06:07:12 +0000 |
commit | 0c6db9417dceeb082296c4e097be5de3ee1c5eb7 (patch) | |
tree | d9d087d431c9c75775098bd66cddf0213f06adf5 /test/SemaCXX/elaborated-type-specifier.cpp | |
parent | 885c27bfd33c92412a3fb071c3f0fffc6b671783 (diff) |
Implement support for comparing pointers with <, >, <=, >=, ==, and !=
in C++, taking into account conversions to the "composite pointer
type" so that we can compare, e.g., a pointer to a derived class to a
pointer to a base class.
Also, upgrade the "comparing distinct pointer types" from a warning to
an error for C++, since this is clearly an error. Turns out that we
hadn't gone through and audited this code for C++, ever.
Fixes <rdar://problem/6816420>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/elaborated-type-specifier.cpp')
-rw-r--r-- | test/SemaCXX/elaborated-type-specifier.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
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; } |