diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-12 18:26:03 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-12 18:26:03 +0000 |
commit | 6250921cc5bd3493a0d99fa2c32ec9716767a965 (patch) | |
tree | 2671ec696754aa647a11a17db00baa96b9e20d67 /test/SemaCXX/conversion-delete-expr.cpp | |
parent | 0ee33cf81eb7e7e53a897efb772edf4d53af5bf1 (diff) |
More work toward having an access method for visible
conversion functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81618 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conversion-delete-expr.cpp')
-rw-r--r-- | test/SemaCXX/conversion-delete-expr.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/SemaCXX/conversion-delete-expr.cpp b/test/SemaCXX/conversion-delete-expr.cpp index bb79fea39f..0a591a285b 100644 --- a/test/SemaCXX/conversion-delete-expr.cpp +++ b/test/SemaCXX/conversion-delete-expr.cpp @@ -43,7 +43,6 @@ void f2 (D2 d) } // Test4 - struct B3 { operator const int *(); }; @@ -69,7 +68,6 @@ struct X { void f4(X x) { delete x; delete x; } // Test6 - struct X1 { operator int(); operator int*(); @@ -78,6 +76,36 @@ struct X1 { void f5(X1 x) { delete x; } // FIXME. May have to issue error here too. +// Test7 +struct Base { + operator int*(); +}; + +struct Derived : Base { + operator int*() const; // not the same function as Base's non-const operator int() +}; + +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'}} +} + +// Test8 +struct BB { + template<typename T> operator T*() const; +}; + +struct DD : BB { + template<typename T> operator T*() const; // hides base conversion + operator int *() const; +}; + +void foo7 (DD d) +{ + // FIXME. We select DD::operator int *() const; g++ issues ambiguity error. Investigate. + delete d; +} + |