summaryrefslogtreecommitdiff
path: root/tests/headers/partial-specialization-and-inheritance.hpp
blob: 4eb8f545833ae92b85af1d52c9af6ba116f8292e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// bindgen-unstable

// This was originally a test case generated by creducing errors in SpiderMonkey
// bindings generation. I've tried to make it understandable by giving more
// meaningful names to everything, and a couple comments.
//
// We don't support partial template specialization, but we *should*
// successfully parse this header, and generate bindings for it, but the usage
// of the partial template specialization should result in opaque blobs.

// A base class providing a method.
template <typename T>
class Base {
public:
  void some_method(T, T);
};

// A template with a default representation.
template <typename U>
class Derived {
    bool b;
};

// A partial specialization for pointers. Note that this should have a different
// and larger layout than the template it is specializing.
template <typename U>
class Derived<U*> : public Base<U*> {
    int x;
    int y;
};

// A struct that uses the partial specialization and method from the partial
// specialization's base class.
struct Usage {
  Usage() {
      static_member.some_method(this, this);
  }

  static Derived<Usage*> static_member;
};