aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/conversion-delete-expr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-09-15 17:21:47 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-09-15 17:21:47 +0000
commitf652793d4d32cc71b5ee2167069cbd363baa75de (patch)
tree11bf576189a2b53a71c7cbb2188eaa92fb0c29b4 /test/SemaCXX/conversion-delete-expr.cpp
parent9eea08ba72f8b1e7faf38e43376b9157fc4a2af2 (diff)
Perform overload resolution when selecting a pointer conversion
function for delete of a class expression and issue good diagnostic when result is ambiguous. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conversion-delete-expr.cpp')
-rw-r--r--test/SemaCXX/conversion-delete-expr.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/test/SemaCXX/conversion-delete-expr.cpp b/test/SemaCXX/conversion-delete-expr.cpp
index 661ce4483e..63a9765396 100644
--- a/test/SemaCXX/conversion-delete-expr.cpp
+++ b/test/SemaCXX/conversion-delete-expr.cpp
@@ -2,16 +2,16 @@
// Test1
struct B {
- operator char *();
+ operator char *(); // expected-note {{candidate function}}
};
struct D : B {
- operator int *();
+ operator int *(); // expected-note {{candidate function}}
};
void f (D d)
{
- delete d; // expected-error {{cannot delete expression of type 'struct D'}}
+ delete d; // expected-error {{ambiguous conversion of delete expression of type 'struct D' to a pointer}}
}
// Test2
@@ -30,25 +30,25 @@ void f1 (D1 d)
// Test3
struct B2 {
- operator const int *();
+ operator const int *(); // expected-note {{candidate function}}
};
struct D2 : B2 {
- operator int *();
+ operator int *(); // expected-note {{candidate function}}
};
void f2 (D2 d)
{
- delete d; // expected-error {{cannot delete expression of type 'struct D2'}}
+ delete d; // expected-error {{ambiguous conversion of delete expression of type 'struct D2' to a pointer}}
}
// Test4
struct B3 {
- operator const int *();
+ operator const int *(); // expected-note {{candidate function}}
};
struct A3 {
- operator const int *();
+ operator const int *(); // expected-note {{candidate function}}
};
struct D3 : A3, B3 {
@@ -56,7 +56,7 @@ struct D3 : A3, B3 {
void f3 (D3 d)
{
- delete d; // expected-error {{cannot delete expression of type 'struct D3'}}
+ delete d; // expected-error {{mbiguous conversion of delete expression of type 'struct D3' to a pointer}}
}
// Test5
@@ -78,16 +78,19 @@ void f5(X1 x) { delete x; } // OK. In selecting a conversion to pointer functio
// Test7
struct Base {
- operator int*();
+ operator int*(); // expected-note {{candidate function}}
};
struct Derived : Base {
- operator int*() const; // not the same function as Base's non-const operator int()
+ // not the same function as Base's non-const operator int()
+ operator int*() const; // expected-note {{candidate function}}
};
-void foo6(const Derived cd) {
- // FIXME. overload resolution must select Derived::operator int*() const;
- delete cd; // expected-error {{cannot delete expression of type 'struct Derived const'}}
+void foo6(const Derived cd, Derived d) {
+ // overload resolution selects Derived::operator int*() const;
+ delete cd;
+
+ delete d; // expected-error {{ambiguous conversion of delete expression of type 'struct Derived' to a pointer}}
}
// Test8
@@ -105,7 +108,3 @@ void foo7 (DD d)
// OK. In selecting a conversion to pointer function, template convesions are skipped.
delete d;
}
-
-
-
-