diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-14 20:41:01 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-14 20:41:01 +0000 |
commit | b191e2dda9f4dc033cb21f9625a78fe80d4ac105 (patch) | |
tree | 978a90ce448cf27366367c3e737b2bcdc333fc51 /test/SemaCXX/conversion-function.cpp | |
parent | 90b6acf414327f953aa696cd64a449a4bd4fbb0d (diff) |
Used visible conversion function api to do overload
resolution of type conversion functions in base and
current class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81784 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conversion-function.cpp')
-rw-r--r-- | test/SemaCXX/conversion-function.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp index cde2851bf3..37ffc1bb53 100644 --- a/test/SemaCXX/conversion-function.cpp +++ b/test/SemaCXX/conversion-function.cpp @@ -75,3 +75,21 @@ C::operator const char*() const { return 0; } void f(const C& c) { const char* v = c; } + +// Test. Conversion in base class is visible in derived class. +class XB { +public: + operator int(); +}; + +class Yb : public XB { +public: + operator char(); +}; + +void f(Yb& a) { + if (a) { } // expected-error {{value of type 'class Yb' is not contextually convertible to 'bool'}} + int i = a; // OK. calls XB::operator int(); + char ch = a; // OK. calls Yb::operator char(); +} + |