diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-01-27 20:28:01 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-01-27 20:28:01 +0000 |
| commit | 8006e76b4edfffacb7946fa08ddad2996fe730b2 (patch) | |
| tree | 0cf03fb15105d705726163273fa74f80ec503405 /clang/test | |
| parent | a462f5cc073a5103850ca9508faa33bfb848a2f0 (diff) | |
| download | bcm5719-llvm-8006e76b4edfffacb7946fa08ddad2996fe730b2.tar.gz bcm5719-llvm-8006e76b4edfffacb7946fa08ddad2996fe730b2.zip | |
Implement the Microsoft __is_convertible_to type trait, modeling the
semantics after the C++0x is_convertible type trait. This
implementation is not 100% complete, because it allows access errors
to be hard errors (rather than just evaluating false).
Original patch by Steven Watanabe!
llvm-svn: 124425
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/type-traits.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp index 7962dffe32a..54d1236dd85 100644 --- a/clang/test/SemaCXX/type-traits.cpp +++ b/clang/test/SemaCXX/type-traits.cpp @@ -497,3 +497,31 @@ void is_base_of() { isBaseOfT<BaseA<int>, DerivedB<int> >(); isBaseOfF<DerivedB<int>, BaseA<int> >(); } + +struct FromInt { FromInt(int); }; +struct ToInt { operator int(); }; +typedef void Function(); + +void is_convertible_to() { + int t01[T(__is_convertible_to(Int, Int))]; + int t02[F(__is_convertible_to(Int, IntAr))]; + int t03[F(__is_convertible_to(IntAr, IntAr))]; + int t04[T(__is_convertible_to(void, void))]; + int t05[T(__is_convertible_to(cvoid, void))]; + int t06[T(__is_convertible_to(void, cvoid))]; + int t07[T(__is_convertible_to(cvoid, cvoid))]; + int t08[T(__is_convertible_to(int, FromInt))]; + int t09[T(__is_convertible_to(long, FromInt))]; + int t10[T(__is_convertible_to(double, FromInt))]; + int t11[T(__is_convertible_to(const int, FromInt))]; + int t12[T(__is_convertible_to(const int&, FromInt))]; + int t13[T(__is_convertible_to(ToInt, int))]; + int t14[T(__is_convertible_to(ToInt, const int&))]; + int t15[T(__is_convertible_to(ToInt, long))]; + int t16[F(__is_convertible_to(ToInt, int&))]; + int t17[F(__is_convertible_to(ToInt, FromInt))]; + int t18[T(__is_convertible_to(IntAr&, IntAr&))]; + int t19[T(__is_convertible_to(IntAr&, const IntAr&))]; + int t20[F(__is_convertible_to(const IntAr&, IntAr&))]; + int t21[F(__is_convertible_to(Function, Function))]; +} |

