OSDN Git Service

fix PR23716
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / template-2.mm
1 /* Test if ObjC classes (and pointers thereto) can participate
2    in C++ overloading.  Correct handling of cv-qualifiers is 
3    key here.  */
4 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
5
6 /* { dg-do compile } */
7
8 @interface foo {
9   int a, b;
10 }
11 @end
12
13 struct bar {
14   int c, d;
15 };
16
17 template <class _Tp>
18 struct allocator {
19   typedef _Tp*       pointer;
20   typedef const _Tp* const_pointer;
21   typedef _Tp&       reference;
22   typedef const _Tp& const_reference;
23
24   pointer address(reference __x) const { return &__x; }
25   const_pointer address(const_reference __x) const { return &__x; }
26 };
27
28 allocator<bar *> b;
29 allocator<foo *> d;