diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-11 21:44:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-11 21:44:33 +0000 |
commit | 5346278f81930e7fd0545bbbb2fc217c6921b109 (patch) | |
tree | cbd237e369e0bcde0fa6f98ef22e0dea91e26e01 /test/SemaCXX/conversion-delete-expr.cpp | |
parent | 52604ab71a74b8ec481255dfeea7dc9dba63b1a5 (diff) |
Patch to build visible conversion function list lazily and make its
first use in calling the conversion function on delete statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conversion-delete-expr.cpp')
-rw-r--r-- | test/SemaCXX/conversion-delete-expr.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/test/SemaCXX/conversion-delete-expr.cpp b/test/SemaCXX/conversion-delete-expr.cpp new file mode 100644 index 0000000000..bb79fea39f --- /dev/null +++ b/test/SemaCXX/conversion-delete-expr.cpp @@ -0,0 +1,83 @@ +// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s + +// Test1 +struct B { + operator char *(); +}; + +struct D : B { + operator int *(); +}; + +void f (D d) +{ + delete d; // expected-error {{cannot delete expression of type 'struct D'}} +} + +// Test2 +struct B1 { + operator int *(); +}; + +struct D1 : B1 { + operator int *(); +}; + +void f1 (D1 d) +{ + delete d; +} + +// Test3 +struct B2 { + operator const int *(); +}; + +struct D2 : B2 { + operator int *(); +}; + +void f2 (D2 d) +{ + delete d; // expected-error {{cannot delete expression of type 'struct D2'}} +} + +// Test4 + +struct B3 { + operator const int *(); +}; + +struct A3 { + operator const int *(); +}; + +struct D3 : A3, B3 { +}; + +void f3 (D3 d) +{ + delete d; // expected-error {{cannot delete expression of type 'struct D3'}} +} + +// Test5 +struct X { + operator int(); + operator int*(); +}; + +void f4(X x) { delete x; delete x; } + +// Test6 + +struct X1 { + operator int(); + operator int*(); + template<typename T> operator T*() const; // converts to any pointer! +}; + +void f5(X1 x) { delete x; } // FIXME. May have to issue error here too. + + + + |